Mira cómo descargar robots gratis
¡Búscanos en Telegram!
Pon "Me gusta" y sigue las noticias
¿Es interesante este script?
Deje un enlace a él, ¡qué los demás también lo valoren!
¿Le ha gustado el script?
Evalúe su trabajo en el terminal MetaTrader 5
Scripts

How to Disable/Enable Auto/Algo-Trading in both MT5 and MT4. - script para MetaTrader 4

Sahil Bagdi
Publicado por:
Kailash Bai Mina
Visualizaciones:
8748
Ranking:
(31)
Publicado:
2022.04.21 07:38
Empty File.mq4 (0.87 KB) ver
MQL5 Freelance ¿Necesita un robot o indicador basado en este código? Solicítelo en la bolsa freelance Pasar a la bolsa

MT4: 

//--- importing required dll files
#include <WinUser32.mqh>
#import "user32.dll"
int GetAncestor(int, int);
#define MT4_WMCMD_EXPERTS  33020
#import

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void SetAlgoTradingTo(bool trueFalse) {
    //--- getting the current status
    bool currentStatus = IsTradeAllowed();
    //--- if the current status is equal to input trueFalse then, no need to toggle auto-trading
    if(currentStatus != trueFalse) {
        //--- Toggle Auto-Trading
        int main = GetAncestor(WindowHandle(Symbol(), Period()), 2/*GA_ROOT*/);
        PostMessageA(main, WM_COMMAND,  MT4_WMCMD_EXPERTS, 0 );//Toggle Expert Advisor button
    }
}


MT5: 

//--- importing required dll files
#define MT_WMCMD_EXPERTS   32851
#define WM_COMMAND 0x0111
#define GA_ROOT    2
#include <WinAPI\winapi.mqh>

//+------------------------------------------------------------------+
//| Toggle auto-trading button                                       |
//+------------------------------------------------------------------+
void AlgoTradingStatus(bool newStatus_True_Or_False) {
    //--- getting the current status
    bool currentStatus = (bool) TerminalInfoInteger(TERMINAL_TRADE_ALLOWED);
    //--- if the current status is equal to input trueFalse then, no need to toggle auto-trading
    if(trueFalse != newStatus_True_Or_False) {
        //--- Toggle Auto-Trading
        HANDLE hChart = (HANDLE) ChartGetInteger(ChartID(), CHART_WINDOW_HANDLE);
        PostMessageW(GetAncestor(hChart, GA_ROOT), WM_COMMAND, MT_WMCMD_EXPERTS, 0);
    }
}
//+------------------------------------------------------------------+
    Account History Export Account History Export

    Export the history of transactions on the MT4 trading account.

    ADXm (experiment) ADXm (experiment)

    ADXm experiment (metatrader 4 versions)

    Listing all MT4 Signals' properties to a CSV file Listing all MT4 Signals' properties to a CSV file

    This simple quick & dirty script code will output a CSV file of all the Signals' properties as reported by the MQL4 Trade Signals functionality.

    Detecting the start of a new bar or candle Detecting the start of a new bar or candle

    Detecting the start of a new bar or candle, in the OnTick() event handler of an expert advisor.