Hi Everyone can Anyone please help me with this code it has 2 errors in line 73 and 23

 
// Define the required indicators
input int fast_ma_period = 5;
input int slow_ma_period = 20;
input int rsi_period = 14;
input int bollinger_bands_period = 20;
input int bollinger_bands_deviation = 2;

// Define the trading parameters
input double risk_percent = 1.0;
input int max_trades_per_day = 4;
input int break_even_pips = 20;
input int partial_close_pips = 50;

// Define the trading hours
input string start_trading_time = "08:00";
input string end_trading_time = "15:00";

// Define the required variables
int trades_today = 0;
double last_trade_time = 0;

// Define the trading function
void trade() {
    // Check if we have already taken the maximum number of trades for the day
    if (trades_today >= max_trades_per_day) {
        return;
    }

    // Check if we are within the trading hours
    datetime current_time = TimeLocal();
    datetime start_time = StrToTime(start_trading_time);
    datetime end_time = StrToTime(end_trading_time);

    if (current_time < start_time || current_time > end_time) {
        return;
    }

    // Calculate the required indicators
    double fast_ma = iMA(Symbol(), PERIOD_M1, fast_ma_period, 0, MODE_EMA, PRICE_CLOSE, 0);
    double slow_ma = iMA(Symbol(), PERIOD_M1, slow_ma_period, 0, MODE_EMA, PRICE_CLOSE, 0);
    double rsi = iRSI(Symbol(), PERIOD_M1, rsi_period, PRICE_CLOSE, 0);
    double upper_band = iBands(Symbol(), PERIOD_M1, bollinger_bands_period, bollinger_bands_deviation, 0, PRICE_CLOSE, MODE_UPPER, 0);
    double lower_band = iBands(Symbol(), PERIOD_M1, bollinger_bands_period, bollinger_bands_deviation, 0, PRICE_CLOSE, MODE_LOWER, 0);

    // Check if the conditions for a long trade are met
    if (fast_ma > slow_ma && rsi > 50 && Ask < upper_band) {
        double entry_price = Ask;
        double stop_loss = entry_price - break_even_pips * Point;
        double partial_close = entry_price + partial_close_pips * Point;

        // Place the trade
        bool result = OrderSend(Symbol(), OP_BUY, lot_size, entry_price, 3, stop_loss, partial_close, "Day Trading Bot", MagicNumber, 0, Green);

        if (result) {
            trades_today++;
            last_trade_time = current_time;
        }
    }

    // Check if the conditions for a short trade are met
    if (fast_ma < slow_ma && rsi < 50 && Bid > lower_band) {
        double entry_price = Bid;
        double stop_loss = entry_price + break_even_pips * Point;
        double partial_close = entry_price - partial_close_pips * Point;

        // Place the trade
        bool result = OrderSend(Symbol(), OP_SELL, lot_size, entry_price, 3, stop_loss, partial_close, "Day Trading Bot", MagicNumber, 0, Red);

        if (result) {
            trades_today++;
            last_trade_time = current_time;
        }
    }

 
Learn to use the </> tool to insert your code please.
 
  1.     double fast_ma = iMA(Symbol(), PERIOD_M1, fast_ma_period, 0, MODE_EMA, PRICE_CLOSE, 0);

    Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
    Next time, post in the correct place. The moderators will likely move this thread there soon.

  2. Please use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum #25 (2019)
              Forum rules and recommendations - General - MQL5 programming forum (2023)
              Messages Editor

  3. Brendan van der Merwe: help me with this code it has 2 errors in line 73 and 23
    Your trade function does not have a closing brace.
    void trade() {
        ⋮
        // Check if the conditions for a short trade are met
        if (fast_ma < slow_ma && rsi < 50 && Bid > lower_band) { <<<< Start of short trade
            ⋮
            bool result = OrderSend(…);
    
            if (result) {…}
        }                                                        <<<< End of short trade
    <<<<<< No end of function.
  4. OrderSend does not return a bool.
  5. You have no event handlers
Reason: