I'm new to this and I'm trying to create a new bot. Pleas help.

 

First of all as I sad I'm new and do not know how to program nor how to fix problems. I want to try a simple rsi strategy on the EUR/HUF pair just to see how thing work and to experiment. I did all I could , research online and putting different lines together looking up forums for help but there s nothing. I get the same errors (a lot). This is my code and if you can help then please help me.

//+------------------------------------------------------------------+
//|                                                       my rsi.mq5 |
//|                                  Copyright 2023, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#include <Trade\Trade.mqh>
#include <trade\position.mqh>

#property copyright "Copyright 2023, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"

// define input parameters
input double LotSize = 0.01;
input int Leverage = 50;
input int RSI_Period = 10;
input double Overbought_Level = 70;
input double Oversold_Level = 30;

// define global variables
int ticket = 0;

// define trading function
void TradeRSI()
{
    // calculate RSI value
    double rsi = iRSI(_Symbol, PERIOD_CURRENT, RSI_Period, PRICE_CLOSE, 0, 0, 0);


    
    // check if RSI is overbought
    if (rsi >= Overbought_Level)
    {
        // close existing buy position if any
        if (PositionSelect(_Symbol) == POSITION_TYPE_BUY)
        {
            ticket = PositionGetInteger(POSITION_TICKET);
            OrderClose(ticket, PositionGetDouble(POSITION_VOLUME), Bid, 10, clrRed);
        }
        
        // open sell position
        ticket = OrderSend(_Symbol, OP_SELL, LotSize * Leverage, Bid, 10, 0, 0, "RSI Sell", 0, 0, clrRed);
    }
    
    // check if RSI is oversold
    else if (rsi <= Oversold_Level)
    {
        // close existing sell position if any
        if (PositionSelect(_Symbol) == POSITION_TYPE_SELL)
        {
            ticket = PositionGetInteger(POSITION_TICKET);
            OrderClose(ticket, PositionGetDouble(POSITION_VOLUME), Ask, 10, clrGreen);
        }
        
        // open buy position
        ticket = OrderSend(_Symbol, OP_BUY, LotSize * Leverage, Ask, 10, 0, 0, "RSI Buy", 0, 0, clrGreen);
    }
}

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
    //---
    return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
    //---
}

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
    TradeRSI();
}
 
Born Artur:

First of all as I sad I'm new and do not know how to program nor how to fix problems. I want to try a simple rsi strategy on the EUR/HUF pair just to see how thing work and to experiment. I did all I could , research online and putting different lines together looking up forums for help but there s nothing. I get the same errors (a lot). This is my code and if you can help then please help me.

It's mql5
https://www.mql5.com/en/docs/indicators/irsi
 
Your code mixes both MQL4 and MQL5, If I had to guess it was written by ChatGPT. I would refer to the codebase and documentation for MQL5 as the first place to learn.
MQL5 Code Base
MQL5 Code Base
  • www.mql5.com
MQL5 Source Code Library for MetaTrader 5
 
Born Artur: do not know how to program
  1. You have only four choices:

    1. Search for it (CodeBase or Market). Do you expect us to do your research for you?

    2. Try asking at:

    3. MT4: Learn to code it.
      MT5: Begin learning to code it.

      If you don't learn MQL4/5, 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 your code.

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

    We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
              No free help (2017)

  2. Stop using ChatGPT.
              Help needed to debug and fix an AI EA - Trading Systems - MQL5 programming forum (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, 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. Sometimes, not using strict (MT4 code).
    8. Code that will not compile.
    9. Creating code outside of functions.*
    10. Creating incomplete code.*
    11. Initialization of Global variables with non-constants.*
    12. Assigning a MT5 handle to a double or missing the buffer and bar indexes in a MT4 call.*
    13. Useing MT4 Trade Functions without first selecting an order.*
    14. 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.

 
Hi!
I have noticed that you get RSI value in wrong way for MT5 EA.
Method iRSI() creates handle of indicator (int type) and you can get value from this hanlde by method CopyBuffer(). 
Method OrderClose() exists only in MQL4, also you call method OrderSend() in MQL4 way, not MQL5. I propose to use class CTrader for trading operations.
Also I recommend use documentation of MQL5 in developing.