This indicates that you are trying to compile MQL4 code with the MQL5 compiler
This. And look in the codebase to see a working iRSI.
Beginners keep making this same mistake over and over again - writing a lot of code, and "hoping" that it works when that compile button is pressed. Get one thing working at a time. The baby does not run in the beginning, it starts by learning to crawl
-
Stop using ChatGPT/Copilot.
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 - Even it says do not use it for coding. *
- Mixing MT4 and MT5 code together.
- Creating multiple OnCalculate/OnTick functions.
- OnCalculate returning a double.
- Filling buffers with zero in OnInit (they have no size yet). Setting buffer elements to zero but not setting Empty Value to correspond.
- Calling undefined functions.
- Calling MT4 functions in MT5 code.
- Sometimes, not using strict (MT4 code).
- Code that will not compile.
- Creating code outside of functions. *
- Creating incomplete code. *
- Initialization of Global variables with non-constants. *
- Assigning a MT5 handle to a double or missing the buffer and bar indexes in a MT4 call. *
- Useing MT4 Trade Functions without first selecting an order. *
- Uses NULL in OrderSend (MT4). *
bot builder Creating two OnInit() functions. * EA builder EATree Uses objects on chart to save values — not persistent storage (files or GV+Flush.) No recovery (crash/power failure.) ForexEAdvisor - Non-updateing global variables.
- Compilation errors.
- Not checking return codes.
- Not reporting errors.
FX EA Builder - Not checking return codes.
- Loosing open tickets on terminal restart. No recovery (crash/power failure.)
- Not adjusting stops for the spread. *
- Using OrdersTotal directly.
- Using the old event handlers.
-
#ifndef __MARKET_ADAPTATION_MQH__ #define __MARKET_ADAPTATION_MQH__
This is unnecessary in MTx
-
return iMA(_Symbol, PERIOD_M15, period, ma_shift, ma_method, price_type, shift);
That is MT4 call.
double GetRSI(int period, int price_type = PRICE_CLOSE, int shift = 0) { return iRSI(_Symbol, PERIOD_M15, period, price_type);
That is MT5 call, that returns an int.
-
double atr = GetATR(14); return atr > iATR(_Symbol, PERIOD_M15, 14); // Compare with the current ATR value
When will ATR(14) ever be greater than ATR(14)?
-
Why did you post your question in the MT5 General section (a catch all category) instead of the MT5 EA section (non-indicator codeing)?
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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
this is my code
can someone please rewrite the code to solve this issue
thanks <3