-
double iAOMQL5(string symbol, ENUM_TIMEFRAMES tf, int shift) { int handle = iAO(symbol, tf); if(handle < 0) return(-1); else return(CopyBufferMQL5(handle, 0, shift));
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) -
ticket = OrderSend(Symbol(), OP_BUY, 0.01, Ask, 0, Bid - StopLoss * _Point, Bid + TakeProfit * _Point, "Scalping EA", 0, 0, Green);
That is MQL4 code.
-
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 - 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.
- 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.*
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.
Thanks for your comments, there is some truth there.
I have used the ea builder to build and it works fine on my mt5 platform apart from showing errors in the journal when trying set SL or TP.
Now I tried to use chatGPT to convert 2 versions of this code into 1.
I noticed in the code functions were mixed with code written in MQL4. I am not an expert in this, I have a bit of experience
in PHP and HTML.
I understand what say about calling functions that are undefined. Since time is of the essence to me
I would quickly either:
-Hire a developer from here to append the two EAs I created or I could
as well just post the reasonable looking versions from the EA builder.
I would be trying to achieve the following precisely:
-Merge the formulas in 1 ea with conditional logic to scan markets or loop over various currencies pairs
and only open a trade if conditions are met per currency pair.
-For some reason my broker deriv does not understand my SL and TP levels based on journal reports, nevertheless is set
well and this EA makes consistent profits. I can imagine the problem is with the trailing stop, so the developer would
have to look via team viewer or anydesk why what the issue is.
-The EA is able to profit in a backtest dating from the 1996. The backtest show that the right trailing stop is being triggered.
However on the live test on demo, there is some work to be done.
-
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) -
That is MQL4 code.
-
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 - 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.
- 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.*
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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
It keeps on telling me about parenthesis when I try to compile please help
';' - unexpected end of program gold3.mq5 317 41