how to use modify function.
You may find this a useful page to refer to in the future
You also need to be aware of requirements and limitations when making trades and modifications
// Ordersend part double close_price,open_price; int ONumber; //==> Setting ONumber to 0 (zero) every tick close_price =iClose(symbol,15,1); open_price = iOpen(symbol,15,1); if((MacdS<MacdF)&&(P<open_price)&&(P==Ask)&&(OrdersTotal() == 0)) // ==>(OrdersTotal() == 0) means no trading if already // trade open manual opend or from other EA { ONumber = OrderSend(symbol,OP_BUY,lots,Ask,5,S05,R05,"Buy position",MagNum,0,Green); } if(OrdersTotal() == 1) // ==> why not checking all trades for MagNum and right Symbol() { OrderSelect(ONumber,SELECT_BY_TICKET); // Every tick you set ONumber to zero so uncorrect OrderSelect if(Ma>((P+R05)/2)) { OrderModify(ONumber,OrderOpenPrice(),P,R10,0,Red); // fails because int ONumber every tick } return(0); }
deVries:
Hi,
deVries!
I will try that! and then if i have any question, I will write it.
Please understand my bed English.
I have tried .. again again.. but i don't know what is wrong.
in my country, Forex is toddler level..
Please explain in detail.
When this code is executed, the following will appear. (invalid ticket for OrderModify function) (OrderModify error 4051)
how can i do?