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,720 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread
  #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?
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
ATFX Suspends Prop Trading Unit ATFunded -- Full Review …
Funded Trading Evaluation Firms
Election Sunday Resolves: Peru Heads to Runoff at 42pct, …
Prediction Markets & Event Contracts
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 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


© 2026 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 - Downloads - Top
no new posts