HTML Code:
void TpModify(double tp) { double minstoplevel=MarketInfo(Symbol(),MODE_STOPLEVEL); double TakeProfit_B=NormalizeDouble(Ask+minstoplevel + tp*Point,Digits); //BUY double TakeProfit_S=NormalizeDouble(Bid-minstoplevel - tp*Point,Digits); //SELL for (int i=OrdersTotal()-1; i>=0; i--) { if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES))continue; if(OrderSymbol()!=Symbol())continue; if(OrderMagicNumber()!= MagicNumber)continue; if (OrderType() == OP_BUY) { if (OrderOpenPrice()< TakeProfit_B) { if (OrderModify(OrderTicket(), OrderOpenPrice(),OrderStopLoss(), 0,0, clrGreen)) Print("Modifying order, delete TakeProfit"); } if (tp< TakeProfit_B) { if (OrderModify(OrderTicket(), OrderOpenPrice(),OrderStopLoss(), TakeProfit_B,0, clrGreen)) Print("Modifying order, TakeProfit_B!"); else Print("Error modifying order!, error#", GetLastError()); } else if(tp> TakeProfit_B) { if (OrderModify(OrderTicket(), OrderOpenPrice(),OrderStopLoss(), tp, 0, clrGreen)) Print("Modifying order!"); else Print("Error modifying order!, error#", GetLastError()); } } if (OrderType()==OP_SELL) { if (OrderOpenPrice()> TakeProfit_S) { if (OrderModify(OrderTicket(), OrderOpenPrice(),OrderStopLoss(), 0,0, clrGreen)) Print("Modifying order, delete TakeProfit"); } if (tp< TakeProfit_S) { if (OrderModify(OrderTicket(), OrderOpenPrice(),OrderStopLoss(), TakeProfit_S, 0, clrGreen)) Print("Modifying orderTakeProfit_S!"); else Print("Error modifying order!, error#", GetLastError()); } else if (tp> TakeProfit_S) { if (OrderModify(OrderTicket(), OrderOpenPrice(),OrderStopLoss(), tp, 0, clrGreen)) Print("Modifying order!"); else Print("Error modifying order!, error#", GetLastError()); } } }
vi è mai successo avete suggerimenti?