Use the debugger or print out your variables, including _LastError and prices. Do you really expect us to debug your code for you?
Code debugging - Developing programs - MetaEditor Help
Error Handling and Logging in MQL5 - MQL5 Articles (2015)
Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)
First of all, thank you very much for your reply 😊, I'll also take a look at all the links you've provided
But
Seeing your answer, I realise that I've phrased my question incorrectly. Does my code seem correct in terms of the MQL5 language?
or for my two conditions C1(trading time) and C2(trading days) can you advise me on other ways of writing the code, or is that enough for a beginner like me 😊?
and thank you again @ William Roeder
or for my two conditions C1(trading time) and C2(trading days) can you advise me on other ways of writing the code, or is that enough for a beginner like me 😊?
It's fine except it allows unlimited trading if, and only if, you start the EA on the correct date/time. Move it to OnTick.
It's fine except it allows unlimited trading if, and only if, you start the EA on the correct date/time. Move it to OnTick.
ok tks you, and yes we use only this C1 and c2 condition it allows unlimited trading, I will add other condition, this is just for asking about time condition
what is the result of this line :
Print("day : ", myLocalTime.day);
it's not day of and not day of year, So i don't know what kind of day it is ?
ok tks you, and yes we use only this C1 and c2 condition it allows unlimited trading, I will add other condition, this is just for asking about time condition
what is the result of this line :
it's not day of and not day of year, So i don't know what kind of day it is ?
Yes, it's the "day_of_month", shortened to "day", see that example : https://www.mql5.com/fr/docs/constants/structures/mqldatetime
- www.mql5.com
Read this again:
If you do not start the EA on the correct day/time, it allows no trading, ever.
Emphasis on start. Move it to OnTick, to only allow trading on the correct date/time.
- 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 everyone,
I'm still a beginner, is my code correct?
trading hours: from 8Am to to 4Pm (8h to 16h)
trading day : Monday to Thursday
Is my code correct for this type of condition, or am I out of my depth?
Thank you in advance for all your insights 😊
Best Reguards,
ZeroCafeine