Question about "IsTradingAllowed()" function ?

 
Hello,

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.


    }

}


 
Yes You can use IsTradeAllowed function in this way
 
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
 
IsTradeAllowed include IsTradeContextBusy function logic
 
IsTradeAllowed include IsTradeContextBusy function logic


Thanks Slawa. But do I absolutely need to refer to the IsTradeAllowed() function in my EA if I am only running 1 EA on 1 computer ?

Thanks again.

Regards

RJF
Reason: