Hello,
try with :
if (!PositionSelect ( _Symbol )) return ;
Can anyone check out the following script, and explain why it has not yet generated any trade, and whether it well ever trade.
Look up ArraySetAsSeries. also you should use NormalizeDouble your TP and SL that have resulted from your calculation, or you may get 4756 errors.
And also note that codes by AI and ChatGPT are often ridiculed on this forum. you should have removed the OpenAI reference in the code.
mafast maslo should be in global enviro, not in OnTick. This is common issue with AI code.
And after looking at code again, it has too many issues for me think that it is worth fixing. I would also remove MqlRates and instead, use CopyClose with an array called close on the global enviro.
There could be other issues, but not going to respond further. AI code is worthless 8/10 times.Too many things here which warps you from the correct path of making an EA.
1. No magic number
2. Overcomplication (no need for using MqlRates struct)
3. The AI making *sinister* mistakes ie. not using ArraySetAsSeries when multiple bars are used in CopyBuffer (which will make the bot trade randomly)
Don't waste your energy on the wrong thing. Look at articles here which discuss how to code an EA (even at beginner level). Too many people are overlooking this section of the forum https://www.mql5.com/en/articles/15299

- 2024.07.18
- www.mql5.com
Hi,
It works. If iit does not work for you so it means that you are doing something wrong.
There are the instructions about HowTo:

- 2021.03.30
- Eleni Anna Branou
- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Can anyone check out the following script, and explain why it has not yet generated any trade, and whether it well ever trade.