28846173:
so this will close all orders as soon as any there is any profit its just an example in mt4 but what i want is time resume ,,like after this closes all orders i want to resume in lets say 5 minutes how do we do that?
Hi , this is not tested
So what is happening is :
- declare a variable that retains the last time your system fully stopped
- when your system fully stops you capture the time
- if there is a time captured and the limit input is not zero (system active by user) then you run a check
- which compares the difference in seconds of the current time from the last stop time
a more complete solution would retain all that info even after reinits and terminal shutdowns , check for trading etc check if all trades closed etc
input int continueSecs=3600;//continue after stop in seconds datetime stopped=0; int start(){ if(AccountEquity()>AccountBalance()){ CloseOrders(); //should check if they really closed , but not of topic stopped=TimeLocal(); } //if you have a recent stopped time if(stopped!=0&&continueSecs>0){ //difference in seconds int secs_diff=((int)TimeLocal())-((int)stopped); //if the difference crosses over your limit reopen if(secs_diff>=continueSecs){ //open your trades here and reset stopped time stopped=0; } } }
Lorentzos Roussos #:
Hi , this is not tested
So what is happening is :
- declare a variable that retains the last time your system fully stopped
- when your system fully stops you capture the time
- if there is a time captured and the limit input is not zero (system active by user) then you run a check
- which compares the difference in seconds of the current time from the last stop time
a more complete solution would retain all that info even after reinits and terminal shutdowns , check for trading etc check if all trades closed etc
thank you bro
Code | input int continueSecs=3600;//continue after stop in seconds datetime stopped=0; int start(){ if(AccountEquity()>AccountBalance()){ CloseOrders(); //should check if they really closed , but not of topic stopped=TimeLocal(); } //if you have a recent stopped time if(stopped!=0&&continueSecs>0){ //difference in seconds int secs_diff=((int)TimeLocal())-((int)stopped); //if the difference crosses over your limit reopen if(secs_diff>=continueSecs){ //open your trades here and reset stopped time stopped=0; } |
Simplified | input int continueSecs=3600;//continue after stop in seconds datetime stopped=0; int start(){ if(AccountEquity()>AccountBalance()){ CloseOrders(); stopped = TimeLocal() + continueSeconds; } //if the "continue after" has expired. if(stopped < TimeLocal()){ //open your trades here and reset stopped time } } |

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
so this will close all orders as soon as any there is any profit its just an example in mt4 but what i want is time resume ,,like after this closes all orders i want to resume in lets say 5 minutes how do we do that?