
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I don't have problem running it on Strategy Tester. However, I use iBars() to count total bar count on the chart to loop from. Could it be a problem of taking to long test? MQL server may have more than 10 years of data, i guess.
If you cycle all chart bars for each tick (OnCalculate), it will be surely very very slow. You should take care of prev_calculated bars to avoid cycling all of them every time, you don't need them and it eat a lot of unnecessary resources.
If you cycle all chart bars for each tick (OnCalculate), it will be surely very very slow. You should take care of prev_calculated bars to avoid cycling all of them every time, you don't need them and it eat a lot of unnecessary resources.
Sound like int limit = iBars(_Symbol,_Period) - prev_calculated, right?
Sound like int limit = iBars(_Symbol,_Period) - prev_calculated, right?
rates_total - prev_calculated
Check on codebase for some well-done examples.
rates_total - prev_calculated
Check on codebase for some well-done examples.
I think I will count total bars for the last 10 days then loop from that number. This should reduce calculation time from the server as it won't start from the first bar on the chart.
I think I will count total bars for the last 10 days then loop from that number. This should reduce calculation time from the server as it won't start from the first bar on the chart.
No. You can start from the beginning of the chart without problems, but you need to take care of previously already calculated candle to avoid recycling all of them for each tick.
It seems to be better in term of memory usage. but when I tried to change the timeframe, I always got error saying "Out of array..." until I changed back and forth. As you may know the zone or range breakout, I calculate the High and Low within the given time period. I think I need to check the highest and lowest index with limit I loop from.
Your code seems to be broken in multiple ways, but we have no visibility of it.
Thanks for the advice, I managed to make this error gone away by using iHigh() and iLow() instead high[] and low[].