StopLose and TakeProfit

 

Hello

I'm struggling with making my stopLose break even when my take profit reaches the half way I did this code but it doesn't work.

can you help me ?

thanks

 



 if(takeProfit=takeProfit/2)// I don't how to apply it to the code below ? 
 {stopLose=1;}


{

ticket= OrderSend(Symbol(),OP_BUY,lotSize,Ask,3,(Bid -stopLose*Point),(Bid + takeProfit*Point),NULL,0,0,Red); 

}




 
  1. if(takeProfit=takeProfit/2)

    That statements divides takeProfit by to, assigns it back to takeProfit, and since it is non-zero, it is always true.

  2. themasterx7: I'm struggling with making my stopLose break even when my take profit reaches the half way I did this code but it doesn't work. can you help me ?

    You can't do it in OrderSend.

  3. On my Do Not Help List, live in ignorance.
              https://www.mql5.com/en/forum/355754#comment_19269451
              https://www.mql5.com/en/forum/356097/page2#comment_19354226
 
William Roeder:
  1. That statements divides takeProfit by to, assigns it back to takeProfit, and since it is non-zero, it is always true.

  2. You can't do it in OrderSend.

  3. On my Do Not Help List, live in ignorance.
              https://www.mql5.com/en/forum/355754#comment_19269451
              https://www.mql5.com/en/forum/356097/page2#comment_19354226

Once again if you are not willing to help stop wasting both of our time and don't replay to any of my posts, I'm not asking for your help there a lot of good people here I ask them not you .

Thank You and Goodbye.

 
ticket= OrderSend(Symbol(),OP_BUY,lotSize,Ask,3,0,0,NULL,0,0,Red);
   //....................................................
   for(int b=OrdersTotal()-1;b>=0;b--)
   {
   if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES))
   if(OrderSymbol()==Symbol())
   if(OrderType()==OP_BUY)
   {
   if(OrderStopLoss()<=(Bid - stopLose*_Point))
         mod= OrderModify(OrderTicket(),OrderOpenPrice(),(Bid -stopLose*_Point),(Bid + takeProfit*_Point),0,Red);
   }
   }

I used OrderModify but nothing I cant make it break even.

Reason: