Hi,
this is an example code that is working correctly in terminal, but it is not working in stratey tester.
It give me error 4004 on CopyTicks call, but if i code it whitout "while" it is working correctly.
Can someone explain me the reason, please?
First thing to do in such cases is to read the error explicated in documentations.
It says in your case that you have not enough memory to perform the action.
So the code needs more memory than what is remaining in your laptop while running it.
In the Strategy Tester, your while(1) loop causes the problem. Unlike live trading, the tester can’t keep giving ticks on demand, so repeated calls inside the same calculation cycle trigger error 4004.
The solution is simple: call CopyTicks() just once per OnCalculate() and let the tester advance time naturally. Also, set last_tick_time = ticks[copied-1].time_msc + 1 to avoid requesting the same tick again.
In the Strategy Tester, your while(1) loop causes the problem. Unlike live trading, the tester can’t keep giving ticks on demand, so repeated calls inside the same calculation cycle trigger error 4004.
The solution is simple: call CopyTicks() just once per OnCalculate() and let the tester advance time naturally. Also, set last_tick_time = ticks[copied-1].time_msc + 1 to avoid requesting the same tick again.
Hi, yes i understood that While(1) is not supprted in TESTER.
In Tester, can i be sure onCalculate and onTick() are called for each tick in real tick mode? Or, like live chart, they can miss ticks?
About last_tick_time, yes, mine was an example.
- 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,
this is an example code that is working correctly in terminal, but it is not working in stratey tester.
It give me error 4004 on CopyTicks call, but if i code it whitout "while" it is working correctly.
Can someone explain me the reason, please?