Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1956

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
This assumes that there are ticks during each second of the day — they don't. What if there are no ticks during a specific period? There can be minutes between ticks during the Asian session.
Thank you @William Roeder, I believe you identified the root cause! I wasn't even considering the possibility of 'no Ticks' within the time window that I define.
That said, I ran a quick test without the Alerts for EURUSD, and get almost no Ticks in unless I extend the trade window as large as an hour before the candle close -- which is not realistic (?)
I tried using OnTimer() to use time as a trigger, and it looks great, but unfortunately it doesn't work with StrategyTester :(
Any other ideas that I can try?
Hello! I am having trouble using Array Elements in Boolean Inequalities for If Statements.
I have 14 moving averages. Hardcoded, they crash MT4.
In an array they work. I can't use iMAOnArray because there is no Price parameter, which is absolutely necessary.
When I compare hardcoded MA's in an inequality statement, in this case for a If parameter, it is equated as True or False.
But when I compare MA's as Array Elements the same way, there is no pass.
So I'm at an impass. I can't hardcode the MA's because it crashes MT4. I can't use iMAOnArray because there is no Price parameter. And I can't use the Array Elements in inequalities.
I've tried parsing the Array Elements into integers, and no go.
I've tried equating a new variable to the Arrayed moving average, and no go.
What do I do?
You are using a LWMA period of three.
On MT4 v434, division quotient don't give floating point values(Bug??) - MQL4 programming forum (2012)
build 2504 & 2506 Bug - General - MQL5 programming forum - Page 2 #17 (2020)
The ENUM_APPLIED_PRICE PRICE_HIGH is two. Two+two/3000 =two=PRICE_HIGH
Use the debugger or print out your variables, including _LastError and prices and find out why. 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)
The window that you defined was once second wide.
Some arrows disappear if I refresh the chart. The only thing I need is for it not to erase those arrows, to be as reliable when running the visual backtest. Could anyone give me a hand?
<deleted>
I need some help, please.
I want to allow a user to change the colours of trendlines to his preferred colours.
I have tried various combinations of ENUM_OBJECT_PROPERTY_INTEGER, OBJPROP_COLOR and clrRed (for example) but I can't get it to work.
Could somebody help me with the correct code, please?
Many thanks,
.
I need some help, please.
I want to allow a user to change the colours of trendlines to his preferred colours.
I have tried various combinations of ENUM_OBJECT_PROPERTY_INTEGER, OBJPROP_COLOR and clrRed (for example) but I can't get it to work.
Could somebody help me with the correct code, please?
Many thanks,
.
Post the code that you have tried.
This is one of the combinations I tried.
extern ENUM_OBJECT_PROPERTY_INTEGER OBJPROP_COLOR; int ColourH1=clrPaleGoldenrod;
extern ENUM_OBJECT_PROPERTY_INTEGER OBJPROP_COLOR; int ColourH4=clrBurlyWood;
extern ENUM_OBJECT_PROPERTY_INTEGER OBJPROP_COLOR; int ColourD1=clrSaddleBrown;
extern ENUM_OBJECT_PROPERTY_INTEGER OBJPROP_COLOR; int ColourW1=clrLawnGreen;
extern ENUM_OBJECT_PROPERTY_INTEGER OBJPROP_COLOR; int ColourH1=clrGreen;