BinaryOptions.net Forums Binary Options Strategy
Options

Expert Advisor in MetaTrader 4 for Binary Options : How to give the Expiry in the ordersend() ?

NykIcedryverNykIcedryver Posts: 7
edited December 2014 in Binary Options Strategy
Hi,

I'm using MT4 with Binary Options Module to developp some Expert Advisors.

I just have a question : What's the syntax of the MQL4 command ordersend() to give the 3 parameters of the Binary Option ?

In fact, for the Binary Option, we have to give the Investment, the UP or DOWN and the Expiry.
In the parameters of the ordersend(), i don't see this 3 types of parameters for Binary Options.
It seems that UP is equal to BUY and DOWN to SELL !
It seems that Investment take place in the "Number of Lots/Volume" !

But where the Expiry take place ???
At first, i think that could take place in the "Expiration Time", or perhaps in the "StopLess" ? But it seems that's not the case !!

Thanks by advance if anyone could help me.

Regards,

Nyk.

Comments

  • Options
    BryanMacBryanMac Posts: 851 ✭✭✭
    edited October 2014
    You would need to set it to look for candle close not time. As its tick based. It gets a time update when there is a tick so if you go 5 seconds without a tick then time does not move.
    Bryan Mcafee
    Hit me up on skype at Brymcafee (McAllen TX)
    www.tradingaxis.com
  • Options
    NykIcedryverNykIcedryver Posts: 7
    Hi,

    First, thanks for your reply.

    I understand the fact that the EA run on each Tick Event only, except if we use the OnTimer function with a Timer Event.
    And of course, my EA does its works on each tick to determine if it's the moment to send an UP or DOWN for a Binary Option.

    But my problem is not that one, but to send the order properly. For a Binary Option, we have to give the Expiry to the Broker.
    For example, if i want to place a Binary Option UP with an Expiry of 5 mn, where this information take place in the ordersend(...) ?

    When i place an order manually in the interface, i can see the order in my history. I see the Investment take place in Volume, i see the UP equal to BUY (and DOWN to SELL), but the Expiry of the Option is not appears in the order.
    So how this parameter is given to the broker ?
  • Options
    BryanMacBryanMac Posts: 851 ✭✭✭
    edited December 2014
    you would need a api compatible with the broker.

    Signal push has one that works with a lot of brokers but they charge per trade.

    It runs in MT4 and as a google chrome extension is the way I have seen it.
    Bryan Mcafee
    Hit me up on skype at Brymcafee (McAllen TX)
    www.tradingaxis.com
  • Options
    NykIcedryverNykIcedryver Posts: 7
    I already have this "api". It's The "Binary Options for MetaTrader" from TradeToolsFX.
    And i have an account with a broker that use it.
    All is OK from this hand.
    On the other hand, the last thing that makes problem is in the developpment of an EA, the usage of the ordersend() ...

    I will make somes tests with this command ordersend() ...
  • Options
    BryanMacBryanMac Posts: 851 ✭✭✭
    Which Broker are you connecting to?
    Bryan Mcafee
    Hit me up on skype at Brymcafee (McAllen TX)
    www.tradingaxis.com
  • Options
    NykIcedryverNykIcedryver Posts: 7
    My broker is StarFishFX.

    And i already verified that Trading is Allowed for EA with BO.
  • Options
    NykIcedryverNykIcedryver Posts: 7
    I have realized some tests.
    For example, send an order without specifying this parameter.

    With this format :
    ordersend(Symbol(),OP_BUY,10.0,CurrentPrice,0.0,0.0,0.0,"UP",magic,0,clrLime);

    - OP_BUY equals to UP for BO, and OP_SELL equals to DOWN dor BO
    - The investment for this BO take place in the Volume (10.0 in this example)

    If i place an Investment not accepted by the broker (like $5 for example) i have an error 131 (invalid trade volume). With a good value for investment, this error disappear.

    But it remains an error 133 (trade not allowed) with this ordersend().
    The automatised trading is activated in MetaTrader and the Broker accept trading with EA (i verified with InfoMarket() and IsTradeAllowed()).
    So i think this error occured because of the lack of the Expiry in the order ...

    So the question is alive ...
  • Options
    NykIcedryverNykIcedryver Posts: 7
    Hello,

    To conclude with this question, here is the solution.
    The Expiry of the Binary Options take place in the comment with a specific format : "BO exp:60"
    The Expiry is in seconds (900 for 15 minutes, 3600 for 1 hour, etc...)

    So the full command for a Binary Option is :

    OrderSend(Symbol(), Action, Investment, Price, 0, 0, 0, "BO exp:Expiry", magic, 0, Color);

    where :
    Symbol() is the Symbol to trade
    Action is : OP_BUY for UP / OP_SELL for DOWN
    Investment is the price to invest in this Binary Options (must correspond to an investment available at your broker) (format double)
    Price is the price at the moment the order is sent (for example Close[0])
    Expiry is the time of expiry of the Binary Options (in seconds) included in the text of the comment in the format "BO exp:60"
    magic is the magic number if you want to use it
    the last but one parameter must be 0 (it's the Expiration Time of the ordersend)

    This syntax is not so easy to guess !!
  • Options
    mt4bousermt4bouser Posts: 1

    Hello,

    To conclude with this question, here is the solution.
    The Expiry of the Binary Options take place in the comment with a specific format : "BO exp:60"
    The Expiry is in seconds (900 for 15 minutes, 3600 for 1 hour, etc...)

    So the full command for a Binary Option is :

    OrderSend(Symbol(), Action, Investment, Price, 0, 0, 0, "BO exp:Expiry", magic, 0, Color);

    where :
    Symbol() is the Symbol to trade
    Action is : OP_BUY for UP / OP_SELL for DOWN
    Investment is the price to invest in this Binary Options (must correspond to an investment available at your broker) (format double)
    Price is the price at the moment the order is sent (for example Close[0])
    Expiry is the time of expiry of the Binary Options (in seconds) included in the text of the comment in the format "BO exp:60"
    magic is the magic number if you want to use it
    the last but one parameter must be 0 (it's the Expiration Time of the ordersend)

    This syntax is not so easy to guess !!

    Hello,

    i have try to put a EA program on a metatrader 4 chart for binary options trading, but the EA does not work, did you had simular problem and a solution?
  • Options
    ninja_bodotnetninja_bodotnet Posts: 232 admin
    Hi mt4bouser - there are many reasons why the EA might not work. Can you be more specific?
  • Options
    BryanMacBryanMac Posts: 851 ✭✭✭
    Who is the broker?
    Bryan Mcafee
    Hit me up on skype at Brymcafee (McAllen TX)
    www.tradingaxis.com
  • Options
    Hi mt4bouser,

    what exactly doesn't work ? Some errors ? Could you give more details ?
  • Options
    MarcioFJRMarcioFJR Posts: 1
    Hi Nyki , would you give me an example of EA to BO .. I am trying the code you said above and not working?
  • Options
    dinesh_ndinesh_n Posts: 1
    Hello

    I can see this post is very old. But can someone help me on this topic please.

    I wrote a simple EA just to see if this command works; but couldnt get going.

    I caught the GetlastError() with "0" which suggests there is no error.

    However; i cant see orders being placed in Go Markets BO Pairs (which i opened using fx lite). I can manually place the order; however; it is not working using EA ).

    Can someone suggest please.
    void OnTick()
    {
    //ordersend(Symbol(),OP_BUY,10.0,iClose(NULL,0,0),0.0,0.0,0.0,"UP",0,0,clrLime);

    OrderSend(Symbol(),OP_BUY,5,iClose(Symbol(),0,0),0,0,0,"BO exp:60",0,0,clrWhite);
    }


    Thanks
    D
Sign In or Register to comment.