Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
I don't know what the point of this is
slPrice = NormalizeDouble(OrderOpenPrice()+(Point*TrailingStop),Digits);
You have to select an order before you can use OrderOpenPrice().
int ticket=OrderSend(Symbol(),op_type,Lots,price,3,0,TProfit,"#Order "+totalOrders,magicNo,0,ordColor); if(ticket>0) { if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) { ticket = OrderTicket(); if (op_type == OP_SELL) { price = Bid; TProfit = price-TakeProfit*Point; ordColor = "Red"; slPrice = price-(Point*TrailingStop); } OpenOrdersChk(); if (OrderModify(ticket,price,slPrice,TProfit,0,ordColor)==false) Print("Error OrderModify : #",ticket, " Price: ",price," SL: ",slPrice," TP: ",TProfit);
For a sell you are trying to modify the SL so that it will be below the current price.
It must be above the current price.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi all experts,
I am new to MQL programming and try on some EA programming but facing problem whenever call to OrderModify(). There is no compilation error but on running the EA in tester will give Error 130 on OrderModify() call. Attached below my create order function code for review.
Any advice and comments are welcome.
Thanks in advance.