Hello,
Use "iBars()" and similar timeseries access functions to instantly get actual data.
Use "RefreshRates()" to get actual data in "Bars" variable and in similar predefined variables for sure.
By the way, I never use "IndicatorCounted()" function, and I do not remember exactly why. To avoid unnecessary recalculations I use another approach.
Regards,
hmm, I`m not sure I`m following you, so far I`m using this, but it keeps on print at every tick and is not very great for backtesting :
int counter=1;
for(int i=1; i<=300; i++)
{
if (Close[i-1] > SMA)
{
if (Close[i-1]>Open[i-1])
{
count = count +1;
}
if (Close[i-1]<Open[i-1])
{
count = count - 1;
}
Print("Count =",count);
}
hmm, I`m not sure I`m following you, so far I`m using this, but it keeps on print at every tick and is not very great for backtesting :
?
I do not disclosed here my approach to avoid unnecessary recalculations, yet.
?
This approach is to give the control to the block of checks in the beginning of "start()" function.
!
I did it now !
!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
Just had a quick MQL4 question.
How would one approach bar counting in MQL4, I know of the "bars" variable and iBar() .
I would like to able to print how many bars above 10 SMA there were last year, I get the result of the backtest would be that value . ( Would you actually run that in the backtester ? )
cheers,