Auto Take Profit

 
input int   InpStopLossPoints    =  150;  // Stop loss in points                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//--- 
datetime checkTime   =  TimeCurrent()-30;                   // Only looking at trades in last 30 seconds
   int      cnt         =  OrdersTotal();
for (int i=cnt-1; i>=0; i--) {
   if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if (OrderMagicNumber()==0 && OrderStopLoss()==0
            && (OrderType()==ORDER_TYPE_BUY || OrderType()==ORDER_TYPE_SELL)) {
            // magic 0 = manual entry, sl 0 means not set
         if (OrderOpenTime()>checkTime) {                   // lets you override after 30 seconds
            double   stopLoss       =  InpStopLossPoints*SymbolInfoDouble(OrderSymbol(), SYMBOL_POINT);
            double   stopLossPrice  =  (OrderType()==ORDER_TYPE_BUY) ?
                                       OrderOpenPrice()-stopLoss :
                                       OrderOpenPrice()+stopLoss;
            stopLossPrice           =  NormalizeDouble(stopLossPrice, (int)SymbolInfoInteger(OrderSymbol(), SYMBOL_DIGITS));
            if (OrderModify(OrderTicket(), OrderOpenPrice(), stopLossPrice, OrderTakeProfit(), OrderExpiration())) {}
         }
      }
   }
}
  }
//+------------------------------------------------------------------+

Hello¡ May someone convert this auto stop loss code into an auto take profit code¿ Thank you!

 
Use the insert code button </>.
 
Mohibul Hoque: ¡ May someone convert this auto stop loss code into a auto take profit code¿

Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
          No free help (2017)

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum (2018)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting).
          No free help (2017)