MQL4 - automated forex trading   /  

Forum

numbers of bars since a past date

Back to topics list To post a new topic, please log in or register

avatar
19
spillsome 2006.10.07 18:58 
I would like to know how to calculate the number of bars since the last time my 2 ema crossed.

What to use, iBarShift ? and how ?
Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization

Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization

This article dwells on implementation algorithm of simplest trading systems. The article will be useful for beginning traders and EA writers.


avatar
597
irusoh1 2006.10.07 19:31 
If you have the time when they crossed you can use iBarShift. It will give you the index of the bar at certain time.
If you don't then you need to count bars in a loop from 0 upwards until ema cross.

avatar
19
spillsome 2006.10.12 12:07 
irusoh1 wrote:
If you have the time when they crossed you can use iBarShift. It will give you the index of the bar at certain time.
If you don't then you need to count bars in a loop from 0 upwards until ema cross.

thanks, do you have an example of code that loop from 0 upwards until ema cross ?

Back to topics list  

To add comments, please log in or register