Results 1 to 1 of 1
 3 Attachment(s)    

Thread: I need help to fix this code ..

  1. #1
    Junior Member
    Join Date
    Nov 2020
    Posts
    1

    Exclamation I need help to fix this code ..

    [/QUOTE]
    The code working without any problem's ..
    but the only problem it shown errors under expert option in mt4 , and this makes lag ..
    here the picture :

    I need help to fix this code ..-screen-shot-2020-11-13-at-10-10-11-pm-png



    so if anyone can help and fix this codes for me , I will be thanks ...
    thank you so much
    have a nice day.





    Here the Main Error :
    I need help to fix this code ..-screen-shot-2020-11-13-at-10-10-11-pm-png





    MetaEditor Error's :
    I need help to fix this code ..-screen-shot-2020-11-13-at-7-33-29-pm-png




    First Error ( Orderselect) :

    I need help to fix this code ..-screen-shot-2020-11-13-at-7-34-08-pm-png




    code :

    {
    OrderSelect(i,SELECT_BY_POS);
    int type=OrderType();
    if(( OrderSymbol()==Symbol()) && (OrderMagicNumber()==Magic))
    {

    switch(type)
    {
    case OP_BUY : t=1;
    case OP_SELL : t=1;
    case OP_BUYLIMIT : t=1;
    case OP_BUYSTOP : t=1;
    case OP_SELLLIMIT : t=1;
    case OP_SELLSTOP : t=1;
    }
    }
    }




    2nd Error :


    {
    //---if opened order is "Buy", close another pending order "Sellstop" and use trailing stop for opened "Buy" order
    OrderSelect(ticket1,SELECT_BY_TICKET);
    if(OrderType()==OP_BUY)
    {
    // delete pending order
    OrderDelete(ticket2);
    // use Trailling Stop
    if(Bid-OrderOpenPrice()>Point*TrailingStop)
    {
    if(OrderStopLoss()<Bid-Point*TrailingStop)
    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
    }
    }
    }
    //---if opened order is "Sell", close another pending order "Buystop" and use trailing stop for opened "Sell" order
    OrderSelect(ticket2,SELECT_BY_TICKET);
    if(OrderType()==OP_SELL)
    {
    // delete pending order
    OrderDelete(ticket1);
    // use Trailling Stop
    if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
    {
    if(OrderStopLoss()>(Ask+Point*TrailingStop))
    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*TrailingStop,OrderTakeProfit(),0,Red);
    }
    }
    }
    }




    3RD Error
    :

    {
    // delete pending order
    OrderDelete(ticket2);
    // use Trailling Stop
    if(Bid-OrderOpenPrice()>Point*TrailingStop)
    {
    if(OrderStopLoss()<Bid-Point*TrailingStop)
    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
    }
    }
    }





    Order modify Error :


    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
    }









    Order select error
    :


    {
    //---if opened order is "Buy", close another pending order "Sellstop" and use trailing stop for opened "Buy" order
    OrderSelect(ticket1,SELECT_BY_TICKET);
    if(OrderType()==OP_BUY)
    {
    // delete pending order
    OrderDelete(ticket2);
    // use Trailling Stop
    if(Bid-OrderOpenPrice()>Point*TrailingStop)
    {
    if(OrderStopLoss()<Bid-Point*TrailingStop)
    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
    }
    }
    }
    //---if opened order is "Sell", close another pending order "Buystop" and use trailing stop for opened "Sell" order
    OrderSelect(ticket2,SELECT_BY_TICKET);
    if(OrderType()==OP_SELL)
    {
    // delete pending order
    OrderDelete(ticket1);
    // use Trailling Stop
    if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
    {
    if(OrderStopLoss()>(Ask+Point*TrailingStop))
    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*TrailingStop,OrderTakeProfit(),0,Red);
    }
    }
    }
    }



    Order delete error:



    {
    // delete pending order
    OrderDelete(ticket1);
    // use Trailling Stop
    if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
    {
    if(OrderStopLoss()>(Ask+Point*TrailingStop))
    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*TrailingStop,OrderTakeProfit(),0,Red);
    }
    }
    }
    }


    and the last error ( order modify ) :



    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*TrailingStop,OrderTakeProfit(),0,Red);
    }
    Last edited by influx; 11-14-2020 at 06:27.

Similar Threads

  1. Example of MQ3 code
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 07-13-2016, 17:29
  2. Need Code for S/L and some more
    By Monkesy in forum Ideas for expert advisors
    Replies: 0
    Last Post: 04-05-2011, 11:30
  3. Please help me to code this EA
    By sshirbhate in forum MQL programming
    Replies: 2
    Last Post: 03-21-2011, 13:03
  4. Help my code
    By fellargasi in forum MQL programming
    Replies: 0
    Last Post: 10-27-2010, 19:37
  5. Help with code
    By fxwealth in forum MQL programming
    Replies: 1
    Last Post: 03-25-2010, 18:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


GadgetVersus GadgetVersus France W3Ask W3Ask Brasil W3Ask Deutschland W3Ask Espaņa W3Ask France W3Ask Italia W3Ask Nederland