need help Pleas my code doesn't open trades can someone help me PLEAS

 
 #include <MovingAverages.mqh>
#include <Trade\Trade.mqh>

#define MODE_MAIN 0

double GetRSI()
{
    int rsi_period = 14;
    double rsi_value = iRSI(_Symbol, PERIOD_M5, rsi_period, PRICE_CLOSE);

    return rsi_value;
}

#include <Trade\Trade.mqh>


//+------------------------------------------------------------------+
//| Get the current trend using the SMA indicator                     |
//+------------------------------------------------------------------+
enum CTrend
{
    TREND_NONE,
    TREND_UP,
    TREND_DOWN
};

CTrend GetTrend()
{
    int ma_period = 14;
    int ma_shift = 0;
    double ma_prev = iMA(_Symbol, PERIOD_M5, ma_period, ma_shift, MODE_SMA, PRICE_CLOSE);
    double ma_current = iMA(_Symbol, PERIOD_M5
    , ma_period, 0, MODE_SMA, PRICE_CLOSE);

    if(ma_prev < ma_current) {
        return TREND_UP;
    } else if(ma_prev > ma_current) {
        return TREND_DOWN;
    } else {
        return TREND_NONE;
    }
}

//+------------------------------------------------------------------+
//| Get the current RSI value                                         |
//+------------------------------------------------------------------+


//+------------------------------------------------------------------+
//| Get the current MACD trend direction                              |
//+------------------------------------------------------------------+
enum CMACDTrend
{
    MACD_TREND_NONE,
    MACD_TREND_UP,
    MACD_TREND_DOWN
};

CMACDTrend GetMACDTrend()
{
    int macd_fast_period = 12;
    int macd_slow_period = 29;
    int macd_signal_period = 9;
   double macd_prev = iMACD(_Symbol, PERIOD_M5, macd_fast_period, macd_slow_period, macd_signal_period, PRICE_CLOSE);
   double macd_current = iMACD(_Symbol, PERIOD_M5, macd_fast_period, macd_slow_period, macd_signal_period, PRICE_CLOSE);


    if(macd_prev < 0 && macd_current > 0) {
        return MACD_TREND_UP;
    } else if(macd_prev > 0 && macd_current < 0) {
        return MACD_TREND_DOWN;
    } else {
        return MACD_TREND_NONE;
    }
}

//+------------------------------------------------------------------+
//| Open trades based on trend direction, MACD, and RSI values        |
//+------------------------------------------------------------------+
void OnTick()
{
    // Input variables
    double lot_size = 0.2;
    double stop_loss = 50.0;
    double take_profit = 100.0;
    double rsi_buy_threshold = 100.0;
    double rsi_sell_threshold = 200.0;

    // Open maximum 8 buy positions
    int max_trades = 8;

    MqlTradeRequest request;
    MqlTradeResult result;

    ZeroMemory(request);
    ZeroMemory(result);

    for(int i=0; i<max_trades; i++)
    {
        // Determine the trend direction
        CTrend trend = GetTrend();

        // Determine the MACD trend direction
        CMACDTrend macd_trend = GetMACDTrend();

        // Determine the RSI value
        double rsi_value = GetRSI();

        // Open a position based on trend direction, MACD, and RSI values
        if(trend == TREND_UP && macd_trend == MACD_TREND_UP && rsi_value < rsi_buy_threshold)
        {
            // Open a buy position
            request.action = TRADE_ACTION_DEAL; // Set the action to deal
            request.type = ORDER_TYPE_BUY;
            request.volume = lot_size * 100000;
            request.symbol = "EURUSD";
            request.price = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
            request.sl = stop_loss;
            request.tp = take_profit;
            request.deviation = 5;
        }
        else if(trend == TREND_DOWN && macd_trend == MACD_TREND_DOWN && rsi_value > rsi_sell_threshold)
        {
            // Open a sell position
            request.action = TRADE_ACTION_DEAL; // Set the action to deal
            request.type = ORDER_TYPE_SELL;
            request.volume = lot_size * 100000;
            request.symbol = "EURUSD";
            request.price = SymbolInfoDouble(_Symbol, SYMBOL_BID);
            request.sl = stop_loss;
            request.tp = take_profit;
            request.deviation = 5;
        }
        else
        {
            // Do nothing if there is no trend or the RSI value is not favorable
            Print("No trend detected or RSI value not favorable");
            return;
        }

        // Send the trade request
        if(!OrderSend(request, result))
        {
            Print("OrderSend failed with error code ", GetLastError());
        }
    }
}
 
Frikkie Botha:
    int rsi_period = 14;
    double rsi_value = iRSI(_Symbol, PERIOD_M5, rsi_period, PRICE_CLOSE);
  1. Perhaps you should read the manual. iRSI does not return a double.

  2. Perhaps you should read the manual, especially the examples.
       How To Ask Questions The Smart Way. (2004)
          How To Interpret Answers.
             RTFM and STFW: How To Tell You've Seriously Screwed Up.

    They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
              Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
              Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
              How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
              How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
              MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
              How to call indicators in MQL5 - MQL5 Articles (2010)