HELP 'iMA' - wrong parameters count

 

 hi i need help with my code error

'iMA' - wrong parameters count KILANGI DREAM.mq5 43 21

   built-in: int iMA(const string,ENUM_TIMEFRAMES,int,int,ENUM_MA_METHOD,int) KILANGI DREAM.mq5 43 21

'iMA' - wrong parameters count KILANGI DREAM.mq5 44 21

   built-in: int iMA(const string,ENUM_TIMEFRAMES,int,int,ENUM_MA_METHOD,int) KILANGI DREAM.mq5 44 21

'iRSI' - wrong parameters count KILANGI DREAM.mq5 45 23

   built-in: int iRSI(const string,ENUM_TIMEFRAMES,int,int) KILANGI DREAM.mq5 45 23

//+------------------------------------------------------------------+
//|                                                KILANGI DREAM.mq5 |
//|                                  Copyright 2024, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#include <Trade\Trade.mqh>

// Define input parameters
input int FastMAPeriod = 10;
input int SlowMAPeriod = 30;
input int RsiPeriod = 14;
input double Risk = 0.01;
input double TakeProfit = 50;
input double StopLoss = 50;
input double FixedLotSize = 0.1;

double FastMA, SlowMA, RSI;

// Define global variables
CTrade trade;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   // Initialization of indicators
   FastMA = iMA(_Symbol, _Period, FastMAPeriod, 0, MODE_EMA, PRICE_CLOSE);
   SlowMA = iMA(_Symbol, _Period, SlowMAPeriod, 0, MODE_EMA, PRICE_CLOSE);
   RSI = iRSI(_Symbol, _Period, RsiPeriod, PRICE_CLOSE);

   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   double fast_ma = iMA(_Symbol, _Period, FastMAPeriod, 0, MODE_EMA, PRICE_CLOSE, 0);
   double slow_ma = iMA(_Symbol, _Period, SlowMAPeriod, 0, MODE_EMA, PRICE_CLOSE, 0);
   double rsi_value = iRSI(_Symbol, _Period, RsiPeriod, PRICE_CLOSE, 0);

   // Check for buy signal
   if(fast_ma > slow_ma && rsi_value < 70 && !HasOpenPositions())
     {
      OpenOrders(3, ORDER_TYPE_BUY);  // Open 3 buy orders for a standard signal
      if(rsi_value < 30)  // Strong signal condition
        {
         OpenOrders(5, ORDER_TYPE_BUY);  // Open 5 buy orders for a strong signal
        }
     }

   // Check for sell signal
   if(fast_ma < slow_ma && rsi_value > 30 && !HasOpenPositions())
     {
      OpenOrders(3, ORDER_TYPE_SELL);  // Open 3 sell orders for a standard signal
      if(rsi_value > 70)  // Strong signal condition
        {
         OpenOrders(5, ORDER_TYPE_SELL);  // Open 5 sell orders for a strong signal
        }
     }
  }

//+------------------------------------------------------------------+
//| Function to open multiple orders                                 |
//+------------------------------------------------------------------+
void OpenOrders(int numberOfOrders, ENUM_ORDER_TYPE orderType)
  {
   double price = (orderType == ORDER_TYPE_BUY) ? SymbolInfoDouble(_Symbol, SYMBOL_ASK) : SymbolInfoDouble(_Symbol, SYMBOL_BID);
   double stopLoss = (orderType == ORDER_TYPE_BUY) ? price - StopLoss * _Point : price + StopLoss * _Point;
   double takeProfit = (orderType == ORDER_TYPE_BUY) ? price + TakeProfit * _Point : price - TakeProfit * _Point;

   for(int i = 0; i < numberOfOrders; i++)
     {
      if(orderType == ORDER_TYPE_BUY)
        {
         if(trade.Buy(FixedLotSize, NULL, price, takeProfit, stopLoss))
            Print("Buy order placed successfully");
         else
            Print("Error in placing buy order: ", GetLastError());
        }
      else if(orderType == ORDER_TYPE_SELL)
        {
         if(trade.Sell(FixedLotSize, NULL, price, takeProfit, stopLoss))
            Print("Sell order placed successfully");
         else
            Print("Error in placing sell order: ", GetLastError());
        }
     }
  }

//+------------------------------------------------------------------+
//| Function to check if there are open positions                    |
//+------------------------------------------------------------------+
bool HasOpenPositions()
  {
   for(int i = PositionsTotal() - 1; i >= 0; i--)
     {
      if(PositionGetSymbol(i) == _Symbol)
        {
         return(true);
        }
     }
   return(false);
  }
 
  1. Don't hijack other threads for your off-topic post. Next time, make your own, new, thread. A moderator moved your post.

  2. Why did you post in the MT5 General section instead of the MT5 EA section?
              General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
    Next time, post in the correct place. I have moved this thread.

  3. Stop using AI.
              Help needed to debug and fix an AI EA - Trading Systems - MQL5 programming forum #2 (2023)

    ChatGPT (the worst), “Bots Builder”, “EA builder”, “EA Builder Pro”, EATree, “Etasoft forex generator”, “Forex Strategy Builder”, ForexEAdvisor (aka. ForexEAdvisor STRATEGY BUILDER, and Online Forex Expert Advisor Generator), ForexRobotAcademy.com, forexsb, “FX EA Builder”, fxDreema, Forex Generator, FxPro, “LP-MOBI”, Molanis, “Octa-FX Meta Editor”, Strategy Builder FX, “Strategy Quant”, “Visual Trader Studio”, “MQL5 Wizard”, etc., are all the same. You will get something quick, but then you will spend a much longer time trying to get it right, than if you learned the language up front, and then just wrote it.

    Since you haven't learned MQL4/5, therefor there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.

    We are willing to HELP you when you post your attempt (using Code button) and state the nature of your problem, but we are not going to debug your hundreds of lines of code. You are essentially going to be on your own.

    ChatGPT
    1. Even it says do not use it for coding. * 
    2. Mixing MT4 and MT5 code together.
    3. Creating multiple OnCalculate/OnTick functions.
    4. OnCalculate returning a double.
    5. Filling buffers with zero in OnInit (they have no size yet). Setting buffer elements to zero but not setting Empty Value to correspond.
    6. Calling undefined functions.
    7. Calling MT4 functions in MT5 code.
    8. Sometimes, not using strict (MT4 code).
    9. Code that will not compile.
    10. Creating code outside of functions. * 
    11. Creating incomplete code. * 
    12. Initialization of Global variables with non-constants. * 
    13. Assigning a MT5 handle to a double or missing the buffer and bar indexes in a MT4 call. * 
    14. Useing MT4 Trade Functions without first selecting an order. * 
    15. Uses NULL in OrderSend. * 
    bot builder Creating two OnInit() functions. * 
    EA builder
    1. Counting up while closing multiple orders.
    2. Not useing time in new bar detection.
    3. Not adjusting for 4/5 digit brokers, TP/SL and slippage. * 
    4. Not checking return codes.
    EATree Uses objects on chart to save values — not persistent storage (files or GV+Flush.) No recovery (crash/power failure.)
    ForexEAdvisor
    1. Non-updateing global variables.
    2. Compilation errors.
    3. Not checking return codes.
    4. Not reporting errors.
    FX EA Builder
    1. Not checking return codes.
    2. Loosing open tickets on terminal restart. No recovery (crash/power failure.)
    3. Not adjusting stops for the spread. * 
    4. Using OrdersTotal directly.
    5. Using the old event handlers.
    First you get MQL5 handles but assign them to doubles.
       FastMA = iMA(_Symbol, _Period, FastMAPeriod, 0, MODE_EMA, PRICE_CLOSE);
       SlowMA = iMA(_Symbol, _Period, SlowMAPeriod, 0, MODE_EMA, PRICE_CLOSE);
       RSI = iRSI(_Symbol, _Period, RsiPeriod, PRICE_CLOSE);
    
    Then you make MQL4 calls.
       double fast_ma = iMA(_Symbol, _Period, FastMAPeriod, 0, MODE_EMA, PRICE_CLOSE, 0);
       double slow_ma = iMA(_Symbol, _Period, SlowMAPeriod, 0, MODE_EMA, PRICE_CLOSE, 0);
       double rsi_value = iRSI(_Symbol, _Period, RsiPeriod, PRICE_CLOSE, 0);