السلام عليكم استاذي الفاضل
المقصود انه في بداية الصفقة يكون الهدف 50 نقطة والتريلنج ستوب 15 نقطة
وعند الوصول لربح 20 نقطة يتحول التريلنج من 15 نقطة الي 5 نقاط فقط

حاولت ولكن في الكود خطا ممكن حل هذا الخطا

for(int cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL &&
OrderSymbol()==Symbol() &&
OrderMagicNumber()==MagicNumber
)

{
if(OrderType()==OP_BUY)
{
{
}
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>MyPoint*TrailingStop)
{
if(OrderStopLoss()<Bid-MyPoint*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*MyPoint,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}
else
{
{
}
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(MyPoint*TrailingStop))
{
if((OrderStopLoss()>(Ask+MyPoint*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+MyP oint*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}

}
//
//
if(OrderType()==OP_BUY)
{

if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>MyPoint*Trailingprofit)
{
if(OrderStopLoss()<Bid-MyPoint*Trailingprofit)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Trailing*MyPoint,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}



//
else
if(OrderType()==OP_SELL)
{

if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(MyPoint*Trailingprofit))
{
if((OrderStopLoss()>(Ask+MyPoint*Trailingprofit)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+MyP oint*Trailing,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}