Unfortunately, as often happens, AI codes are full of problems and not consistent. First of all, if you have more than 1 trade opened, it will not work correctly for all trades.
I strongely suggest to read documentation, use CTrade classes codes (that you only declared but never used in your code), and to use AI the less possible times.
Anyway, the procedure should be:
- Cycles all your positions (filter by magic or symbol if you need)
- Ignore trades that have SL in profit or at PriceOpen
- Check if PriceCurrent compared to PriceOpen of each position is >= of your "PartialTargetProfit"
- If 3 is true, do the partial closure and move SL to BE.
Unfortunately, as often happens, AI codes are full of problems and not consistent. First of all, if you have more than 1 trade opened, it will not work correctly for all trades.
I strongely suggest to read documentation, use CTrade classes codes (that you only declared but never used in your code), and to use AI the less possible times.
Anyway, the procedure should be:
- Cycles all your positions (filter by magic or symbol if you need)
- Ignore trades that have SL in profit or at PriceOpen
- Check if PriceCurrent compared to PriceOpen of each position is >= of your "PartialTargetProfit"
- If 3 is true, do the partial closure and move SL to BE.
I know that i need the help of a professionist, but in this moment i'm just "playing" with demo accounts to test notions i'm studying.
This is the reason why i asked help to chatgpt.
i will try to improve your advices
thank you so much!
r.
Stop using ChatGPT.
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 |
|
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 |
|
FX EA Builder |
|
Stop using ChatGPT.
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.
hi William, you are right..
for me, now, it is impossible start to learn to code..
it is not matter of 2 or 3 days
i'm trying to find something that "could be good enough" untill i will study how trading works..
if i will start to operate with a real account, i will hire a professionist who will write the code i need
thank you for your advices
regards
r.
Hi guys,
i need your help to solve a problem with the 10025 error when i try to get a partial TP.
i am not good with mql5 so i adapted a basic script i found here with the help of chatgpt.
The goal is to get a partial TP when a gain is reached, move the SL to be and then set another tp for closing the entire position.
So i used 4 variables:
gain for TP 1,
percentage of the position to clos in TP 1
gain for TP 2
when move the SL to BE
Testing it i noticed it generate an error (10025) when try to get the TP1 and, for this reason, the position is closed at TP 2
i really appreciate if someone could help me to solve this problem
Thank you so much
r.
Just learn the MQL language or C++, syntaxes are not much different, best would be to get started with Python, its quite easy to catch on, Just code it yourself. Never use Chat Gpt for coding, its a mixup, it will not generate code correctly, also do not use generators. All of us here that are coders has tried all those tricks before, we were there.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
i need your help to solve a problem with the 10025 error when i try to get a partial TP.
i am not good with mql5 so i adapted a basic script i found here with the help of chatgpt.
The goal is to get a partial TP when a gain is reached, move the SL to be and then set another tp for closing the entire position.
So i used 4 variables:
gain for TP 1,
percentage of the position to clos in TP 1
gain for TP 2
when move the SL to BE
Testing it i noticed it generate an error (10025) when try to get the TP1 and, for this reason, the position is closed at TP 2
i really appreciate if someone could help me to solve this problem
Thank you so much
r.