fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. jonatassantanacaje
    3. Best
    J
    • Profile
    • Following 3
    • Followers 0
    • Topics 5
    • Posts 15
    • Best 1
    • Controversial 0
    • Groups 0

    Best posts made by jonatassantanacaje

    • RE: Help - Custom MQL Code

      @jstap

      //--- 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
          }
      }
      
      posted in Questions & Answers
      J
      jonatassantanacaje
    • 1 / 1