Move to break even tool

Back to topics list To post a new topic, please log in or register
avatar
2
onis_uk 2015.04.30 21:51
 

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  

avatar
13001
WHRoeder 2015.05.01 03:14 #
 
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.
avatar
2
onis_uk 2015.05.03 12:08 #
 
ok thanks, added to the work que ! 
avatar
106
4x_Gypsy 2015.05.03 15:01 #
 
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);
     }
  }

Back to topics list  

To add comments, please log in or register