Look at what you get in the end. Bottom indicator, I didn't touch native code, I just played with parameters. I changed zero bar to the first bar in the price chart in the code of the indicator.
At the moment of crossing, the value of the MA was not the same as it became after the bar was closed. Therefore, this value can only be found at the moment of crossing.
Close[0]=Open[0]
и Close[0]=High [0] и Close[0]=Low[0]
at the opening of a candle.
Therefore, if you need instantaneous, real-time data, you'd better use
double Bidd=NormalizeDouble(Bid,Digits); если цена сверху или
double Askk=NormalizeDouble(Askk,Digits); если цена снизу МА
double MA_lo=NormalizeDouble(MA_lo,Digits);
It's better to normalize all prices to be compared in the condition, so you won't be surprised :)
Hello all! When writing code to test an EA, I need to search for the low in real time inside each minute candlestick. To do this, I chose a predefined variable Low[0] with index 0. The index is zero to search for the low in each current candle.
Here is my code void OnTick()
{
Print("------------", Low[0] );
}
On the first (yellow) candlestick, the variable shows the minimum as I need it to
On all subsequent candlesticks until 2010.01.04 00:30:00 the variable shows -1.6119, i.e. it repeats the minimum of the first candle, rather than looking for minima on every single minute candle. On the candlestick 2010.01.04 00:30:00 it shows every minimum again
On the next candle after this one it shows -1.6128 , i.e. it repeats the minimum of the first candle instead of looking for lows inside each one-minute cand le.
Instead of Low[0] variable I used the same function iLow(NULL , 0,0) , but the effect was the same. QUESTION How to use the mentioned function or variable to search for a minimum in every minute candle, or what other function is it possible to use in MQL4?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Are you visually impaired?
What's with the horse text?
Are you visually impaired?
What's with the horse text?
An accident.
What if a person writes for himself or herself?
It's not like he can measure the distance from an invisible point anyway, the intersection will be somewhere else.
It will not measure the distance from an invisible point anyway, the intersection will be in a different place.
I was saying that if a person is writing for himself, he understands what he is doing and understands what will happen.
This is the forum for trading, automated trading systems and strategy testing.
Any questions from newbies on MQL4 and MQL5, help and discussion on algorithms and codes
Taras Slobodyanik, 2021.02.28 09:37
If you do not know how to check the correctness of deals, they will hang in the air, and the user will say - MT4 is a glitchy one)
I was saying that if one writes for oneself, one understands what one is doing and understands what will happen and will not say
that's how Grails are born)
then not into a variable, but into a buffer, because there will be a lot of such points.
At the moment of crossing, the value of the MA was not the same as it became after the bar was closed. Therefore, this value can only be found at the moment of crossing.
It is how you want the value to be memorized.
But keep in mind that
at the opening of a candle.
Therefore, if you need instantaneous, real-time data, you'd better use
It's better to normalize all prices to be compared in the condition, so you won't be surprised :)
It's how you want the value to be remembered.
But keep in mind that
at the opening of a candle.
So if you want instantaneous, real time, it's better to use
It's better to normalise all prices to be compared in the condition, so you won't be surprised :)
Hello all!
When writing code to test an EA, I need to search for the low in real time inside each minute candlestick. To do this, I chose a predefined variable Low[0] with index 0. The index is zero to search for the low in each current candle.
Here is my code
void OnTick()
{
Print("------------", Low[0] );
}
On the first (yellow) candlestick, the variable shows the minimum as I need it to

On all subsequent candlesticks until 2010.01.04 00:30:00 the variable shows -1.6119, i.e. it repeats the minimum of the first candle, rather than looking for minima on every single minute candle.

On the candlestick 2010.01.04 00:30:00 it shows every minimum again
On the next candle after this one it shows -1.6128 , i.e. it repeats the minimum of the first candle instead of looking for lows inside each one-minute cand le.
Instead of Low[0] variable I used the same function iLow(NULL , 0,0) , but the effect was the same.
QUESTION
How to use the mentioned function or variable to search for a minimum in every minute candle, or what other function is it possible to use in MQL4?
Thank you all for your help.