Download MetaTrader 5
To add comments, please log in or register
Have you found a good programmer? Make a targeted order!
Peter
14
Peter 2015.10.12 05:05 

Hi, first timer here so please excuse if it's a silly question. I have an ea that requires a set number of bars in a chart. I have set the max bars in chart to 60 and the max bars in history to 60 but more bars appear at the next shift so I end up with more than 60 bars on the chart despite setting a maximum of 60.  This idea works well initially but as more bars are added to the chart the ea becomes less reliable.

 As an explanation the ea becomes less reliable as more bars are added as the indicator that the ea runs off has a different time scaling, it uses a lookback period that spreads across what ever chart it runs off.  The solution I had was to run the same number of bars in the chart as the lookback period on the ea but I am having the above issues with that.   

Is there a minimum amount of bars you can have in a chart or is there some kind of tolerance or formula to it that I can account for?

 

Thanks

Peter 

Ovo Cz
2958
Ovo Cz 2015.10.12 07:41  
The number of bars set in options is valid only for the initial chart, then bars keep adding. You could create a chart clone as an offline chart, and repeatedly moving the block of all bars to keep the fixed number of bars, but I am afraid that the easier way is adopting your EA to treat any chart length.
Keith Watford
Moderator
7888
Keith Watford 2015.10.12 07:42  
if you need to lookback 60 bars, then lookback only 60 bars. It shouldn't matter how many bars there are on the chart (as long as it is at least 60).
Peter
14
Peter 2015.10.12 08:12  
Thanks Ovo, much appreciated. Do you know if there is a limit to the number of bars after they continue on?
Peter
14
Peter 2015.10.12 08:15  
Thanks GumRai, that's my issue, I can set the ea to lookback whatever I want but it spreads that amount of periods over however many candles are on the chart. Ideally I would get the formula I need to run off the lookback period on the indicator but unfortunately I don't have the source code.
Ovo Cz
2958
Ovo Cz 2015.10.12 09:55  
Petermac:
Thanks Ovo, much appreciated. Do you know if there is a limit to the number of bars after they continue on?
I guess the limit is integer number type, i.e. 2ˆ31-1
Peter
14
Peter 2015.10.12 10:52  
Ok, thanks again Ovo, very much appreciated.
whroeder1
13602
whroeder1 2015.10.12 12:21  
Ovo: I guess the limit is integer number type, i.e. 2ˆ31-1
Terminal is 32 bits so max RAM is 2^31-1. Bar (TOHLCTSR) is 60 bytes, so divided by 60 is ~35.8 million or 69 years of M1
/
To add comments, please log in or register