if( OrderTakeProfit() != ТР ) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), ТР, 0, clrNONE);
Hello friend,
You can try this out. It's no where near prefect, but it should give you some ideas.
void ModifyOrder() {x=0; TakeProfit=0; int TotalOrders=OrdersTotal(); for(TotalOrders=OrdersTotal();TotalOrders>x;x++) { trade = OrderSelect(x,SELECT_BY_POS)==true; Watch = SymbolName(x,true); SL = MarketInfo(Watch,MODE_STOPLEVEL); ticket = OrderTicket(); order_type = OrderType(); Price = OrderOpenPrice(); TakeProfit = OrderTakeProfit(); Price_difference=_Point*SL; if(order_type==OP_SELL) {TakeProfit=Price-Price_difference;} else TakeProfit=Price+Price_difference; if(order_type==OP_SELL) {Stoploss=Ask+Price_difference;} else Stoploss=Bid-Price_difference; bool TrailingStop=OrderModify(ticket,Price,Stoploss,TakeProfit,0,clrGray); if(!TrailingStop) Operation(); else Operation(); } }
GrumpyDuckMan:
Wow! So many help. I will try that. Doumo arigatou.
Hello friend,
You can try this out. It's no where near prefect, but it should give you some ideas.
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
I have a question.
I have already ordered and after that I want to change only takeprofit by using order modify but I don't want to change stoploss.
I want to modify only takeprofit.
double TP=0;
Modified=OrderModify(OrderTicket(),OrderOpenPrice(),SL,TP,0,clrNONE);
If I want to use original stoploss, How can I put SL?