Please help me in some code

 

Please can anyone add stoploss and take profit in this script .. i will be very thankful to you


extern int BuyThreshold = 40;
extern int SellThreshold = 30;
extern double Lots = 1;
extern int MagicNumber = 33;
extern string comment = "by example script";
extern int maxOpenPositions = 3;
extern int shift = 1;

int RSILength = 14;
int TimeOfFirstBar = 0;

int init() {
}

int start() {
    double RSI = 0.0;
    
    if (isFirstTickOfCurrentBar()) {
        RSI = iRSI(NULL, PERIOD_H1, RSILength, PRICE_CLOSE, shift);
        Print("Got RSI value for period H1 and shift ", shift, " equals to ", RSI);
        // Buy Condition
        if ( RSI >= BuyThreshold && OrdersTotal() < maxOpenPositions) {
            if (doBuy() == false) { 
                return (0);
            }
        }
        // Close condition
        if ( RSI <= SellThreshold && OrdersTotal() > 0) {
           if(doClose() == false) {
               return(0);
           }
        }
    }
}

// Figures out the first tick of a new bar
bool isFirstTickOfCurrentBar() {
    if (TimeOfFirstBar != Time[1]) {
        TimeOfFirstBar = Time[1];
        return (true);
    }
    return (false);
}

// Close an order checking magic number to make sure it is generated from current script
bool doClose() {
    OrderSelect(0, SELECT_BY_POS, MODE_TRADES);
    if (OrderClose( OrderTicket(), OrderLots(), Ask, 0, White) == -1) {
        Print ("Failed to close trade ", OrderTicket(),", error # ", GetLastError());
        return(false);
    }
    Print ("Successfully closed trade ", OrderTicket(),", error # ", GetLastError());
    return(true);
}

// Open a new order
bool doBuy() {
    int ticket = OrderSend( Symbol(), OP_BUY, Lots, Ask, 0, 0.0, 0.0, comment, MagicNumber, 0, Lime);
    if (ticket < 0) {
      Print ("Failed to open trade, error # ", GetLastError());
      return (false);
    }
    Print ("Successfully opened ticket ", ticket);
    return (true);
}
Reason: