How To Disable Algo trading in MT5? - page 2

 
Would there be a way to disable/enable a specific direction? Allow buys only or sells only?
 
Vincent Cugliari #: Would there be a way to disable/enable a specific direction? Allow buys only or sells only?
Only MT4 has that possibility! There is no such selection on MT5 unfortunately.
 
Tiago Praxedes #:
#define MT_WMCMD_EXPERTS   32851 #define WM_COMMAND 0x0111 #define GA_ROOT    2 #include <WinAPI\winapi.mqh> //+------------------------------------------------------------------+ //| Toggle auto-trading button                                       | //+------------------------------------------------------------------+ void AlgoTradingStatus(bool Enable)   {    bool Status = (bool) TerminalInfoInteger(TERMINAL_TRADE_ALLOWED);    if(Enable != Status)      {       HANDLE hChart = (HANDLE) ChartGetInteger(ChartID(), CHART_WINDOW_HANDLE);       PostMessageW(GetAncestor(hChart, GA_ROOT), WM_COMMAND, MT_WMCMD_EXPERTS, 0);      }   }  

Thanks. 

 
Sunfire #:

Hello,


Anyway to disable algo trading of current chart EA only?


Thank you

Just use ExpertRemove to remove the EA from that chart. It will be the same as disabling the auto trading.

 
Christian Paul Anasco #:

Just use ExpertRemove to remove the EA from that chart. It will be the same as disabling the auto trading.

That would not work as what I was looking for is to just play and pause, There is not to re-attach after ExpertRemove().

 
Kailash Bai Mina #: That would not work as what I was looking for is to just play and pause, There is not to re-attach after ExpertRemove().

Then code that. When in doubt, think!

input bool Enabled=true;
void OnTick(){
   if(!Enabled) return;
 
William Roeder #:

Then code that. When in doubt, think!

That's an interesting approach though It did not serve the purpose, the goal was to disable trading for a EA without its source code, Sorry I did not mention that very clearly.

 
Kailash Bai Mina #:

That's an interesting approach though It did not serve the purpose, the goal was to disable trading for a EA without its source code, Sorry I did not mention that very clearly.

hi , i have the same issue too

 
Wai Keung Wu #:

hi , i have the same issue too

What issue ? If you don't want an EA to trade, just don't run it.

Anything using DLL to play with the Algo Trading button or specific EA "Allow algo trading" is a bad idea.

 
Wai Keung Wu #:

hi , i have the same issue too

Code a controller EA which can close/reopen a chart with a template including the ea you want to control