what is wrong with this code?
if(OrdersTotal() > 0 && OrderSelect(0, SELECT_BY_POS)==true && A==1)
{
switch(OrderProfit())
{
case -0.2:
if(OrderStopLoss() < resetlong + 0.0003)
{
OrderModify(OrderTicket(),OrderOpenPrice(),resetlong+ 0.0003,OrderTakeProfit(),Blue) ;
Alert(GetLastError()); break;
}
case 0.0 :
if(OrderStopLoss() < resetlong + 0.0009)
{
OrderModify(OrderTicket(),OrderOpenPrice(),resetlong+ 0.0009,OrderTakeProfit(),Blue) ;
Alert(GetLastError()); break;
}
case 0.3 :
if(OrderStopLoss() < resetlong + 0.0014)
{
OrderModify(OrderTicket(),OrderOpenPrice(),resetlong+ 0.0014,OrderTakeProfit(),Blue) ;
Alert(GetLastError()); break;
}
case 0.4 :
if(OrderStopLoss() < resetlong + 0.0015)
{
OrderModify(OrderTicket(),OrderOpenPrice(),resetlong+ 0.0015,OrderTakeProfit(),Blue) ;
Alert(GetLastError()); break;
}
case 1.0 :
if(OrderStopLoss() < resetlong + 0.0020)
{
OrderModify(OrderTicket(),OrderOpenPrice(),resetlong+ 0.0020,OrderTakeProfit(),Blue) ;
what it is supposed to do, is at each profit level(which is each case) the stoploss is supposed to move up, but for some reason the stoploss is being moved up before the specified case it is supposed to move up at.
i just tried it out and i only got upto case 0.3 but the stoplose was moved up asif it hit case 1.0
if(OrdersTotal() > 0 && OrderSelect(0, SELECT_BY_POS)==true && A==1)
{
switch(OrderProfit())
{
case -0.2:
if(OrderStopLoss() < resetlong + 0.0003)
{
OrderModify(OrderTicket(),OrderOpenPrice(),resetlong+ 0.0003,OrderTakeProfit(),Blue) ;
Alert(GetLastError()); break;
}
case 0.0 :
if(OrderStopLoss() < resetlong + 0.0009)
{
OrderModify(OrderTicket(),OrderOpenPrice(),resetlong+ 0.0009,OrderTakeProfit(),Blue) ;
Alert(GetLastError()); break;
}
case 0.3 :
if(OrderStopLoss() < resetlong + 0.0014)
{
OrderModify(OrderTicket(),OrderOpenPrice(),resetlong+ 0.0014,OrderTakeProfit(),Blue) ;
Alert(GetLastError()); break;
}
case 0.4 :
if(OrderStopLoss() < resetlong + 0.0015)
{
OrderModify(OrderTicket(),OrderOpenPrice(),resetlong+ 0.0015,OrderTakeProfit(),Blue) ;
Alert(GetLastError()); break;
}
case 1.0 :
if(OrderStopLoss() < resetlong + 0.0020)
{
OrderModify(OrderTicket(),OrderOpenPrice(),resetlong+ 0.0020,OrderTakeProfit(),Blue) ;
what it is supposed to do, is at each profit level(which is each case) the stoploss is supposed to move up, but for some reason the stoploss is being moved up before the specified case it is supposed to move up at.
i just tried it out and i only got upto case 0.3 but the stoplose was moved up asif it hit case 1.0