Download MetaTrader 5
To add comments, please log in or register
Launch your trading signal and add account monitoring!
Suffi
33
Suffi 2013.12.06 20:37 

I need help.

My EA open the first order with a stoploss and takeprofit, the price goes the false side, now the EA open the next order without SL and TP.

Before the order are open, I will cleare the SL and TP from order before. I don´t know how I do that.

I get always error1.

Suffi

whroeder1
14242
whroeder1 2013.12.06 20:49  
  1. Error 1 means you didn't try to change anything.
  2. You say you know how to open "without SL and TP." So how do you do that?
Suffi
33
Suffi 2013.12.06 20:59  
WHRoeder:
  1. Error 1 means you didn't try to change anything.
  2. You say you know how to open "without SL and TP." So how do you do that?

Hi WHRoeder,

first order:

...
int Ticket_1 = OrderSend(Symbol(), OP_BUY, Lot, Ask, Slippage, 0, 0, EA_Name, Magic, 0, Lime);
if (Ticket_1>0)
{
Last_Lot=Lot;
Last_Time=iTime(NULL,0,0);
}
...

now mody the order

...
if (Order_Type==OP_BUY &&
MyRealOrdersTotal(Magic)==1 &&
Order_Stop_Loss!=(LastOpenedPrice(Magic)+ Point*Traling_Stop) &&
Ask>=(LastOpenedPrice(Magic)+ Point*Traling_Start

{OrderModify(OrderTicket(),0,(LastOpenedPrice(Magic)+ Point*Traling_Stop),(LastOpenedPrice(Magic)+ Point*TP),0,Blue);}
...

second oder with the try to clear the SL and TP

...
OrderModify(OrderTicket(),0,0,0,0,0); //thats not right
//if (LastOpenedType(Magic)==1 && MyRealOrdersTotal(Magic)==1) Lot=LastOpenLot(Magic);
int Ticket_3 = OrderSend(Symbol(), OP_BUY, Lot, Ask, Slippage, 0, 0, EA_Name, Magic, 0, Lime);
...

Suffi

whroeder1
14242
whroeder1 2013.12.06 21:28  

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. OrderModify(OrderTicket()
    You can NOT use OrderTicket or any other trading functions until you do a successful OrderSelect. Does LastOpenedPrice() do that? how do you check if it worked? What are Function return values ? How do I use them ? - MQL4 forum
  3. OrderModify(OrderTicket(),0,0,0,0,0); //thats not right
    Why are you trying to modify the price. Why are you trying to modify SL and TP to zero when that's what you set them to when you opened the order? What are Function return values ? How do I use them ? - MQL4 forum
Suffi
33
Suffi 2013.12.06 21:53  
WHRoeder:

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. You can NOT use OrderTicket or any other trading functions until you do a successful OrderSelect. Does LastOpenedPrice() do that? how do you check if it worked? What are Function return values ? How do I use them ? - MQL4 forum
  3. Why are you trying to modify the price. Why are you trying to modify SL and TP to zero when that's what you set them to when you opened the order? What are Function return values ? How do I use them ? - MQL4 forum

The OrderSelect is above of the extract of the code.
It works well, except for the error message in the Journal

I would not change the price.

What I have to register there?


Suffi

whroeder1
14242
whroeder1 2013.12.06 23:41  
Suffi: I would not change the price.
What is the second parameter to OrderModify and what value did you pass?
/
To add comments, please log in or register