Move to break even tool

 

Is there such a tool to move my stop to BE at a given price ?

I would ultimately like a line i can set like the take profit line, if price hits it stop is moved to entry price ..........

can anyone help me out?

 

cheers onis  

 
onis_uk: Is there such a tool to move my stop to BE at a given price ?
You have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
 
ok thanks, added to the work que ! 
 
onis_uk:

Is there such a tool to move my stop to BE at a given price ?

I would ultimately like a line i can set like the take profit line, if price hits it stop is moved to entry price ..........

can anyone help me out?

 

cheers onis  

//+------------------------------------------------------------------+
//Move to breakeven function
//+------------------------------------------------------------------+
void MoveToBreakeven()
  {
   int buymod=0;
   int sellmod=0;

   for(int b=OrdersTotal()-1; b>=0; b--)
     {
      if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES))
            if(OrderSymbol()==Symbol())
               if(OrderType()==OP_BUY)
                  if(OrderOpenPrice()>OrderStopLoss())
                     if(Bid-OrderOpenPrice()>PipsToLockIn*pips)
                        buymod=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+(PipsToLockIn*pips),OrderTakeProfit(),0,CLR_NONE);
     }
   for(int s=OrdersTotal()-1; s>=0; s--)
     {
      if(OrderSelect(s,SELECT_BY_POS,MODE_TRADES))
            if(OrderSymbol()==Symbol())
               if(OrderType()==OP_SELL)
                  if(OrderOpenPrice()<OrderStopLoss())
                     if(OrderOpenPrice()-Ask>PipsToLockIn*pips)
                        sellmod=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-(PipsToLockIn*pips),OrderTakeProfit(),0,CLR_NONE);
     }
  }
Reason: