Download MetaTrader 5
To add comments, please log in or register
Have you published a program in the Market? Place it in your blog as well - the widget will help!
onisuk
109
onisuk 2015.04.30 19: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  

whroeder1
13936
whroeder1 2015.05.01 01: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.
onisuk
109
onisuk 2015.05.03 10:08  
ok thanks, added to the work que ! 
Donald Gibson
487
Donald Gibson 2015.05.03 13: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);
     }
  }
/
To add comments, please log in or register