NexusFi: Find Your Edge


Home Menu

 





Last cross of indicator above or below a value (0)


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,087 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

Last cross of indicator above or below a value (0)

  #1 (permalink)
tozwp
Milwaukee WI/US
 
Posts: 7 since Feb 2012
Thanks Given: 2
Thanks Received: 1

Trying to figure out how to code something but not quite sure where to start. Part of a strategy needs to find the time or bar number of lowest low or highest high of the oscillator between the current cross and the last cross of the zero line. In other words, if the oscillator is crossing 0 on this bar, go back and find the last cross of 0. Between this bar and the bar that the oscillator last crossed zero, find the bar with the highest high or lowest low. Conceptually it seems easy but I don't have a clue where to start. Would this have to be done in a loop structure working backward to check each bar for a cross or can I use something with the Cross command and a qualifier for the last occurance like [1]?

If anyone can give me an idea of where to start I'd appreciate it. Thanks!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Are there any eval firms that allow you to sink to your …
Traders Hideout
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Futures True Range Report
The Elite Circle
Build trailing stop for micro index(s)
Psychology and Money Management
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
23 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #3 (permalink)
Bimi
London
 
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58



tozwp View Post
Trying to figure out how to code something but not quite sure where to start. Part of a strategy needs to find the time or bar number of lowest low or highest high of the oscillator between the current cross and the last cross of the zero line. In other words, if the oscillator is crossing 0 on this bar, go back and find the last cross of 0. Between this bar and the bar that the oscillator last crossed zero, find the bar with the highest high or lowest low. Conceptually it seems easy but I don't have a clue where to start. Would this have to be done in a loop structure working backward to check each bar for a cross or can I use something with the Cross command and a qualifier for the last occurance like [1]?

If anyone can give me an idea of where to start I'd appreciate it. Thanks!

don't look back, look forward.


initialize 2 variables: a bar counter, and a maxvalue.

start with the first cross,

as soon as the osc cross above zero,
barcounter = currentbar ( timecount if you wish)
maxvalue = osc

next bar:
if osc > maxvalue then do the above assignment again.

keep doing this on every bar and you will always know the max value of the osc and the bar number of that occurence.


when the osc cross zero again, the variables will be re-initialized.

Reply With Quote
  #4 (permalink)
tozwp
Milwaukee WI/US
 
Posts: 7 since Feb 2012
Thanks Given: 2
Thanks Received: 1

Thanks! I hadn't thought of working forward with this. I figured it would be simpler to wait for the event and then work backwards. I think I can manage to put together something using your technique. Appreciate the help!

Reply With Quote
Thanked by:
  #5 (permalink)
Bimi
London
 
Posts: 118 since Mar 2010
Thanks Given: 42
Thanks Received: 58


tozwp View Post
Thanks! I hadn't thought of working forward with this. I figured it would be simpler to wait for the event and then work backwards. I think I can manage to put together something using your technique. Appreciate the help!

You are welcome.

Please press the "Thanks" button if you like the answer.

Reply With Quote




Last Updated on July 28, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts