gooly:
To save mainly backtest time I want to execute a function only once with in a bar not every tick
void function(){ static datetime Time0; if (Time0 == Time[0]) return; Time0 = Time[0]; :
if( lstOPN[per] == t ) continue; // THIS continue DOES NOT WORK and I don't understand why??? // here a new candle with its first tick - or not?
Do you have history for the other timeframes? Also remember you can't get other data in the tester for other timeframes.
Hi,
I am sorry for this rather ridiculous piece of code - but it drives me crazy.
...What the hell I do wrong, where broke my brain?
I thank you very much in advance for any help out of this trap.
Gooly
gooly:
To save mainly backtest time I want to execute a function only once with in a bar not every tick
-
Do you have history for the other timeframes? Also remember you can't get other data in the tester for other timeframes.
hmm, I read:
Zero bar of another timeframe for the same symbol under test is modeled approximately
Open = correct Open, Close = correct Close, Low = min (Open,Close), High = max (Open,Close), Volume = final Volume (false)
Actually I am not trying to get data from other timeframes - at the moment the timeframe of the backtest (visual mode) is the same as the one selected by PERs[per] = m15.
But, thanks, I didn't know this, I'll be aware of this!
Actually I am not trying to get data from other timeframes - at the moment the timeframe of the backtest (visual mode) is the same as the one selected by PERs[per] = m15.
![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
Hi,
I am sorry for this rather ridiculous piece of code - but it drives me crazy.
To save mainly backtest time I want to execute a function only once with in a bar not every tick so I wrote:
The first continue: if ( ..[sys] == 0) continue; works perfectly!!
The second does not, what ever I try?? On every new tick the second if .. continue; is passed as if lstOPN[per] would NOT be equal t?
I stamped all that on the screen with TimeToStr( x, TIME_SECONDS) and I see that t and lstOPN[per] DO show exactly the same time e.g. 22:15:00,
while TimeCurrent() (as well priinted) shows 22:17:23 and then 22:17:33, 22:17:36 and so on and my 'brach-counter' count2 continously up each new tick???
Even if I print out on my screen the pure integer-values of the times: lstOPN[per] shows the same value as t (1328472900 for 20:15:00 (backtest!) while TimeCurrent() has 1328473150,
so the second if (.. == t ) continue; is passed and the next iteration is not called.
What the hell I do wrong, where broke my brain?
I thank you very much in advance for any help out of this trap.
Gooly