- Is risk diversification even possible in the forex market?
- Issue with Obtaining Ticket Number When Executing a Buy Order mql5
- Adding up the lots...
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
⚠️ Please pay attention!
Expert Advisors and Automated Trading

- www.mql5.com
Most probably due to Incorrectly coded logic and lack of proper understanding of the basics of both MetaTrader and the MQL functionality.
As I stated before, with reason, start small with a simple EA and build it up as you fully grasp how things work.
As it is now, your EA is still very convoluted, making your debugging process very difficult for you especially as a beginner with MQL coding.
And there is no shortcut. You will have to debug your EA, one way or another, until you find what it is doing wrong.
Most probably due to Incorrectly coded logic and lack of proper understanding the basics of both MetaTrader and the MQL functionality.
As I stated before, with reason, start small with a simple EA and build it up as you fully grasp how things work.
As it is now, your EA is still very convoluted, making your debugging process very difficult for you especially as a beginner with MQL coding.
And there is no shortcut. You will have to debug your EA it one way or another, until you find what it is doing wrong.
You don't really expect us to debug your 1000+ lines of code, do you?
That is not what the forum is for. Did I not previously write ...?
I did not look any further once I spotted the above bug. There may be other bugs. So, dedicate some time to look for any other bugs.
You don't really expect us to debug your 1000+ lines of code, do you?
That is not what the forum is for. Did I not previously write ...?
I did not look any further once I spotted the above bug. There may be other bugs. So, dedicate some time to look for any other bugs.
Even though your code has evolved a little, I only have to take one quick look at your code to conclude that it's still extremely "messy" and "stringy".
It is convoluted and unstructured, with it's trading logic spread out all over the place, which can easily lead to contradictory functionality.
This may seem arrogant and condescending, but I am doing my best to convince you to go back to drawing board and start with a small and simple EA, until you can fully understand it all.
When you deal with market orders
if(UpMarket == true && BuyMarket == true && OrdersTotal() == 0)
this is not correct, because you are dealing with Positions, so when you execute market orders, it should be:
if(UpMarket == true && BuyMarket == true && PositionsTotal() == 0)
Please at least first try and build a simplistic EA that follows rules correctly. If you successfully build a simple EA (as advised above) that follows the rules correctly, there will be far less caveats in a bigger project
Hi! I coded a script where the conditionals analyse both daily and one minute time frames, the one conditionals for one day time frame is to buy when the calculations return a value > 0.5 and to sell when the calculations return a value of < -0.5. When trading yesterday on a demo account, my script sold with the EURGBP pair, the issue is however this contradicts the standard of the conditionals as the returned value for the daily time frame was 0.4545454 etc and not a value < -0.5. Does anyone know from experience what would causes a script to contradict it's own conditionals?
You might want to try
double OneDayCalculation = NormalizeDouble(OneDayCalculationPreCalculation / 22, 1);
good luck
Even though your code has evolved a little, I only have to take one quick look at your code to conclude that it's still extremely "messy" and "stringy".
It is convoluted and unstructured, with it's trading logic spread out all over the place, which can easily lead to contradictory functionality.
This may seem arrogant and condescending, but I am doing my best to convince you to go back to drawing board and start with a small and simple EA, until you can fully understand it all.
I appreciate the wisdom!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use