MQL4 Language (BUY and SELL Orders)

2

Someone is aware of this "MQL4" language, it is based on C and is used particularly by a stock exchange listing program. If anyone knows, my question is this: How do I make BUY and SELL orders for Binary Options?

    
asked by anonymous 03.02.2015 / 10:48

1 answer

1

First of all, thanks to everyone who contributed to the issue, I recently received an email from TraderTools FX , which developed the extension for MetaTrader4 to operate Binary Option (OB) directly on the platform, and I received a very basic example, but enough to understand how the orders for OB work. Below is the code provided.

    //+------------------------------------------------------------------+
    //|                                                    BO Expert.mq4 |
    //|                                     Copyright 2013, TradeToolsFX |
    //|                                      http://www.tradetoolsfx.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright 2013, TradeToolsFX"
    #property link      "http://www.tradetoolsfx.com"

    //--- input parameters
    extern int TotalOrders = 5;
    extern double Lots = 1;
    //+------------------------------------------------------------------+
    //| expert initialization function                                   |
    //+------------------------------------------------------------------+
    int init()
      {
    //----

    //----
       return(0);
      }
    //+------------------------------------------------------------------+
    //| expert deinitialization function                                 |
    //+------------------------------------------------------------------+
    int deinit()
      {
    //----

    //----
       return(0);
      }
    //+------------------------------------------------------------------+
    //| expert start function                                            |
    //+------------------------------------------------------------------+
    int start()
      {
       int cnt, ticket, total,cnty, cmd;

       total=OrdersTotal();
       if(total<TotalOrders) 
       {
          for(cnty=0; cnty < TotalOrders - total;cnty++)
          {
             if((cnty%2) == 0)
                cmd = OP_BUY;
             else
                cmd = OP_SELL; 

             ticket=OrderSend(Symbol(),cmd,Lots,Bid,3,0,0,"BO exp:60");        
          }
       } 
       return(0);
      }
    //+------------------------------------------------------------------+
    
04.02.2015 / 18:09