You must have an end time , a restart time and a Forbidden bool value. The system will not open trades when Forbidden==True
Then start will check if end time was reached. If end time was reached, initiate close of all trades and set Forbidden to true. If restart time is reached, set Forbidden to false...
Then start will check if end time was reached. If end time was reached, initiate close of all trades and set Forbidden to true. If restart time is reached, set Forbidden to false...
tbreaker:
got it, thx
I am still learning mql and try different things.
And what about stop trading at a certain point; for example: stop trading if GBPUSD reaches 1.97 (for today, but program starts following day again)
do it like this:got it, thx
I am still learning mql and try different things.
And what about stop trading at a certain point; for example: stop trading if GBPUSD reaches 1.97 (for today, but program starts following day again)
use these vars: int OldDay and int NowDay, defined globally (after externals and before function defs)
inside init make OldDay=Day(); NowDay=Day();
when start begins:
NowDay=Day();
if (NowDay!=OldDay) { Forbidden=False; OldDay=NowDay; }
...
if (MarketInfo("GBPUSD",MODE_BID)>=1.97) { Forbidden=True; //eventually call here a func to close all trades }
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
I want that my expert stop trading at a certain time (for example 6 pm) and close all open position at this time