Yes You can use IsTradeAllowed function in this way
Hi Slawa, thanks again for your answers.
I'm I correct in concluding that a trader does not need to refer to the "IsTradeAllowed" or "IsTradeContextBusy" functions in an EA, if the trader is only running 1 EA on 1 single computer ??
Is the above statement correct?
Thanks again Slawa. Much appreciated.
Kind regards
RJF
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 wanted to know if I need to use the IsTradingAllowed() function in any way, if I only run 1 EA per computer machine ?
This is the way I have used the IsTradingAllowed() function, is this the right way to use it within an endless loop ?(see code below) ?
Please note I have read the MQL4 article about the function on your website.
Thanks in advance.
Regards
RJF
int start() { while( IsStopped()==False ) // endless loop { // // // // // set-up variables int Error; int PositionDiff; int AbsPositionDiff; int TF_GetQtyLots; RefreshRates(); // if less than 100 bars on chart or Trade thread is busy then Exit program. if (IsTradeAllowed()==false) { Alert("Trade Thread is busy"); return(0); // exit program. } if (Bars<100) { Alert("Bars less than 100"); return(0); // exit program. } RefreshRates(); .........rest of EA inserted here. } }