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,068 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)

(login for full post details)
  #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?
Wicked Renko Bars
Traders Hideout
Request for MACD with option to use different MAs for fa …
NinjaTrader
ISO Equity Curve Indicator
NinjaTrader
Volume profile TradeStation
EasyLanguage Programming
News alerts
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tao te Trade: way of the WLD
37 thanks
Deaddogs Stock Trading
27 thanks
GFIs1 1 DAX trade per day journal
26 thanks
Supertradersams Thread Journal on NQ/MNQ
24 thanks
Leaving CFD trading and learning futures
11 thanks

(login for full post details)
  #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
(login for full post details)
  #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
The following user says Thank You to tozwp for this post:
(login for full post details)
  #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