Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1512

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
Yeah, that's a tough question )... Maybe put the colour on invisible
indicator_colorN
depending on the TF.
When the TF is changed, re-initialisation and recalculation takes place. The display calculations can be affected accordingly....
It also depends on the indicator... maybe you have arrows ), then the solution above will work.
According to moderators, there is no option to programmatically hide on any TF " It's not possible to set an indicator visualisation timeframes by code. "
Too bad.
So there are only two options left.
Change the colour to invisible
or set an invisible rendering style.
The second option is easier, because the colours of one style can be several, for example DRAW_COLOR_CANDLES has three of them and you will have to recolour each one.
And style once made invisible and that's it.
All right, we'll work with what we have).
In the properties of the indicator there is an option to hide it on any timeframes.
How to do it programmatically?
Probably like this:
A little late...)
A little late...)
Bad.
That leaves only two options.
Change the colour to invisible
or set an invisible rendering style
The second option is easier, because one style can have several colours, for example DRAW_COLOR_CANDLES has three of them and you will have to recolour each one.
And style once made invisible and that's it.
All right, we'll work with what we have).
Ideally, you will still have the indicator and it will still be in the data window and will still be calculated and drawn with invisible lines.
considering the fact that when switching TFm, reinitialisation takes place, it is probably better not to initialise it?
If theINIT_FAILEDvalue is returned, the indicator will not be unloaded from the chart. Inthis case, the indicator remaining on the chart is inoperative - event handlers arenot called in the indicator.
and plus, you can initialise buffers with an empty value, i.e. clean the indicator.
ArrayInitialise(buf,EMPTY_VALUE);
You will still have the indicator and it will still be in the data window and it will still be calculated and drawn with invisible lines.
considering that when switching TFm, it is reinitialised, it is probably better not to initialise it?
If theINIT_FAILEDvalue is returned, the indicator will not be unloaded from the chart. Inthis case, the indicator remaining on the chart is inoperative - event handlers arenot called in the indicator.
and plus, you can initialise buffers with an empty value, i.e. clean the indicator.
ArrayInitialise(buf,EMPTY_VALUE);
Well, in principle, yes, it is an interesting variant of hiding the indicator.
I'll take it on a note.
I came across the fact that the terminal does not always fulfil the condition for opening or closing a position in the same way.
For example, in the code the condition of position closing is a simple difference between variables WPPrevValH1 and WPValH1:
In practice, I see that the WPR indicator chart shows a significant deviation, but the position is still not closed. Then it closes when it gets losses. And sometimes everything works as it should.
The same applies to the opening conditions. Sometimes it works correctly, and other times it does not.
What am I doing wrong?
If the text file is not readable, the code can be found on google drive: https://drive.google.com/file/d/1ocpywK8q-7BLjjdVavKhEjo4LJFAUSns/view?usp=drive_link.For example, in the code the condition of position closing is a simple difference between variables WPPrevValH1 and WPValH1:
In practice, I see that the WPR indicator chart shows a significant deviation, but the position is still not closed. Then it closes when it gets losses. And sometimes everything works as it should.
The same applies to the opening conditions. Sometimes it works correctly, and other times it does not.
What am I doing wrong?
If the text file is not readable, the code can be found on Google drive: https: //drive.google.com/file/d/1ocpywK8q-7BLjjdVavKhEjo4LJFAUSns/view?usp=drive_link.This is not an MQL problem, it is a problematic brokerage centre.
This is not an MQL problem, it's a problematic DC.