HOW TO TRAIL STOP

To add comments, please log in or register
Raymond Philip
20
Raymond Philip  
if(SellTicket>0)
{       
        Selected = OrderSelect(SellTicket,SELECT_BY_TICKET);
             double CurrentPrice = Ask;
             double SellStopPO = OrderOpenPrice();
             double SellStopSL = OrderStopLoss();
             double SellStopPips = SellStopSL-SellStopPO;
             
             if(CurrentPrice < SellStopPO-SellStopPips*1 && CurrentPrice > SellStopPO-SellStopPips*2 && OrderType() == OP_SELL)
             {
                   Selected = OrderSelect(SellTicket,SELECT_BY_TICKET);
                   double NewStopLoss = SellStopPO-SellStopPips*0.1;
                   bool TicketMod = OrderModify(SellTicket,OrderOpenPrice(),NewStopLoss,OrderTakeProfit(),OrderExpiration(),White);
             }
             if(CurrentPrice < SellStopPO-SellStopPips*2 && CurrentPrice > SellStopPO-SellStopPips*3 && OrderType() == OP_SELL)
             {
                   Selected = OrderSelect(SellTicket,SELECT_BY_TICKET);
                   double NewStopLoss = SellStopPO-SellStopPips*1;
                   bool TicketMod = OrderModify(SellTicket,OrderOpenPrice(),NewStopLoss,OrderTakeProfit(),OrderExpiration(),White);
             }
}

My Intention:

if Price at 1% move SL to 0.1% ,,,, if Price at 2% move SL to 1%


My Problem:

after it execute "if Price at 1% move SL to 0.1%" ,,,, it does not execute "if Price at 2% move SL to 1%"

when I delete "if Price at 1% move SL to 0.1%" ,,,, it then perfectly execute "if Price at 2% move SL to 1%"


My tries:

I tried "else if" but it also doesn't work

To add comments, please log in or register