Alert when Auto Trading is turned off

 

I am trying to notify users that they have turned off their Auto Trading.

Is there a way to send an alert and a Print message when the Auto Trading is turned off in an Expert Advisor?  If so, where would I place the code?


Thanks!!

Eddi Rae

 
eddirae: Is there a way to send an alert and a Print message when the Auto Trading is turned off in an Expert Advisor?  If so, where would I place the code?
  1. Perhaps you should read the manual.
              Common Functions / Alert - Reference on algorithmic/automated trading language for MetaTrader 5

  2. Perhaps you should read the manual.
              Checkup / TerminalInfoInteger - Reference on algorithmic/automated trading language for MetaTrader 5

  3. Where do you think? In OnTick.
 

I have the Alert in the OnDeinit for when the user closes the Expert Advisor or the Chart Window for an element.

When I turn off the "Auto Trading" as the top of FOREXer, the OnDeinit does not run.

You are right!!  At the beginning OnTick(), I placed the following and it keeps on alerting until the Auto Trading is turned back on.

if(!TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)) 
   {
      Alert(my4CastObj.GetSymbol(),":  Auto Trading is turned off!!");
      Print(my4CastObj.GetSymbol(),":  Auto Trading is turned off!!");
      return;
   }   

Thanks so much!!

 
eddirae: When I turn off the "Auto Trading" as the top of FOREXer, the OnDeinit does not run.
Of course not.  Perhaps you should read the manual. Where do you see the button in the reason codes?
          Standard Constants, Enumerations and Structures / Named Constants / Uninitialization Reason Codes - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: