MQL4 language (BUY and SELL orders)

Asked

Viewed 581 times

1

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

  • Documentation in http://docs.mql4.com/

1 answer

1

First of all thank you to everyone who somehow contributed to the issue, I recently received an email from Tradertools FX, that developed the extension for Metatrader4 to operate Binary Option(OB) directly on the platform, and received a very basic example, but enough to understand how the OB orders work. Below is the code available.

    //+------------------------------------------------------------------+
    //|                                                    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);
      }
    //+------------------------------------------------------------------+

Browser other questions tagged

You are not signed in. Login or sign up in order to post.