Hello. Because the default timer is not available in mql4 so I decided to write my own timer. To do so I made one second while cycle. Code Shown below
My problem is that In While Loop Tester stacks. I can't get in if statement.
Can anyone help me?
I am writing this to make my Sleep() function because sleep() doesn't work in strategy tester. Can someone give me advice what to do?
Firstly . . .
Please read some other posts before posting . . .
Please edit your post . . . please use the SRC button to post code: How to use the SRC button.
Secondly . . .
There is no point trying to do what you are doing. If you wait the time in the Strategy Tester will not pass, all you will end up doing is making your CPU warm for no good reason.
Why do you need to Sleep in the Strategy Tester ?
Why do you need to Sleep in the Strategy Tester ?
Thank you for your reply. You can't see the point, I didn't asked that. I didn't provided whole code. In a live mode This code works good. with no CPU warm. I just want to know why it doesn't work in Strategy tester.Because I need timer, After some time to do some code, I can use sleep() in live mode but what to do in Strategy Tester
Thank you for your reply. You can't see the point, I didn't asked that. I didn't provided whole code. In a live mode This code works good. with no CPU warm. I just want to know why it doesn't work in Strategy tester.
In the Strategy Tester TimeLocal() == TimeCurrent() and if you constantly loop there are no ticks so time does not change . . .
TimeLocal() "Note: At the testing, local time is modelled and is the same as the modelled last known server time."
Until you return from start(), nothing is changing. Return from start, on the next call, reevaluate your conditions.
TimeLocal is irrelevant in the tester. You should need to use it at all. TimeCurrent() is the broker's (tester's) time.
Until you return from start(), nothing is changing. Return from start, on the next call, reevaluate your conditions.
TimeLocal is irrelevant in the tester. You should need to use it at all. TimeCurrent() is the broker's (tester's) time.
I don't use start. I use Init. So problem is that stack is full in loop. So now I have no idea How to simulate sleep() function in strategy tester. But loop was in cycle only 1 second and it is enought to full up stack. Need advice, I don't want to use start(), I want to do some code in every some time
Can I Empty Stack ? Set null or something?
It won't help . . . to make time pass in the Strategy Tester you MUST use start() . . . the next tick is not used until start() returns, if start is never called it never returns so the next tick is never used . . . time does not advance.
Ok I understand that in strategy tester the next tick is not used until start() returns. But I just can't get why it works in Live mode and not in tester. OK i will use start, I didn't want to use start() because I can't control its call back. But in tester Ok I will use start()

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
My problem is that In While Loop Tester stacks. I can't get in if statement.
Can anyone help me?
I am writing this to make my Sleep() function because sleep() doesn't work in strategy tester. Can someone give me advice what to do?