Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 204
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
MA crossing occurs between bars - caught a clear example
The MA on the bars to the left and right of the crossing is different from the price at the crossing point. I understand that the questioner wants the value at the exact crossing point instead of the value on one of the neighbouring bars. This exact value can be obtained using linear interpolation - after all, the MA between bars is constructed as straight line segments. Or take the coordinates of each MA on adjacent bars. Construct analytically 2 straight lines and calculate their intersection point. It is possible to calculate by considering 2 similar triangles. A counter question arises - why do we need it? Are the costs commensurate with the value of the result? After all, the intersection points will move if the MA parameters are changed minimally. Most likely, it is required by the head of the course project
I can't find the error in my calculations.
I need to find the high and low of the previous day, but for some reason the low was on the day before
Better to use CopyHigh and CopyLow with period PERIOD_D1 and corresponding bar or time instead.
Any bar of any Timeframe contains generalized information of the corresponding interval of bars of lower Timeframes: maximum, minimum, opening and closing time and volume equal to the sum of volumes of lower bars. More precisely, this information is contained in the corresponding arrays
I would do so, but I may not be able to calculate the data using further algorithm, as I may have to search for other values of yesterday and it will be a chore to rewrite the functions again.
If you could tell me where the error is in my code, I don't understand it. When I try to display the number of bars all fit together, but when I try to get the maximum or minimum, it does not show what it should.
I would do so, but I may not be able to calculate the data because I may have to look for other values from yesterday and it will be a pain in the ass to rewrite the functions again.
If you could tell me where the error is in my code, I don't understand it. When I show the number of bars on the screen, everything converges, but when I try to get the maximum or minimum, it doesn't show what it should.
You've made so much mess that I can't even make sense of it. A mountain of conversions from one to the other...
And all to find the maximum and minimum of the day?
So what's not working for you?
Need to know the maximum of the day? Please:
Need to find out the maximum of yesterday? Easy:
Need to know the low of the day before yesterday? No problem:
Well, you could take the easy way out and use pure quadruple functions:
But I would not advise - using new language constructs, you'll prepare yourself and your code to that someday quadruple will not be supported, and self-discipline and all that ;)
You've made such a mess of it that it's hard to even sort it out. A mountain of conversions from one thing to another...
All to find the highs and lows of the day?
So what's not working for you?
Need to find out the highs of the day? Please:
Need to find out the maximum of yesterday? Easy:
Need to know the low of the day before yesterday? No problem:
Well, you could take the easy way out, and use pure quadruple functions:
But I would not advise - using new language constructs, you'll prepare yourself and your codes that someday quaternion will be unsupported, and self-discipline and all that ;)
I found a mistake myself ( all inattentiveness misread the parameters iHighest, iLowest ).
So not suitable as will need other calculations from yesterday
I found the error myself (all inattention misread the iHighest,iLowest parameters).
This is not suitable as other calculations from yesterday will be needed
if(Red ) OrderSend( ... Buy ...) ; if( Blue ) OrderSend( ... Sell ...) ;
Only the opposite, sell at the top, buy at the bottom...
The function OnInit (the old one asking for init) is executed at start of the indicator (when changing timeframe, recompiling, ...). All used variables must have a value assigned to them. The SetIndexDrawBegin(0,i-1) line is present in the OnInit function; the i variable must be assigned a value or a constant must be used
if(Red ) OrderSend( ... Buy ...) ; if( Blue ) OrderSend( ... Sell ...) ;
Only the opposite, sell at the top, buy at the bottom...
The function OnInit (the old one asking for init) is executed at start of the indicator (when changing timeframe, recompiling, ...). All used variables must have a value assigned to them. In the OnInit function, there is the SetIndexDrawBegin(0,i-1) line; the i variable must be assigned a value or use a constant
To be honest, I don't understand anything, I'm new to Mql4 programming, if you don't mind helping me with the code.
The code usually helps in freelancing.
Here - either the algorithm or to correct your mistakes. But not to rewrite again for you.