Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1512

 
Denis Karavaev #:

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

PlotIndexSetInteger(0, PLOT_LINE_COLOR, 0, DRAW_NONE);

or set an invisible rendering style.

PlotIndexSetInteger(0, PLOT_DRAW_TYPE, DRAW_NONE);

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).

 
Aleksandr Slavskii #:

In the properties of the indicator there is an option to hide it on any timeframes.


How to do it programmatically?

Probably like this:

   PlotIndexSetInteger(0,PLOT_DRAW_TYPE,_Period>PERIOD_H1?DRAW_LINE:DRAW_NONE);


A little late...)

 
Alexander Voronkov #:

A little late...)

Thanks anyway ;-)
 
Aleksandr Slavskii #:

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);

 
Renat Akhtyamov #:

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:

            if(Type == POSITION_TYPE_BUY && WPValH1 < WPPrevValH1)
            {
               m_trade.PositionClose(m_position_ticket);
               Print("WPValH1 = ",(string)WPValH1," WPPrevValH1 = ",(string)WPPrevValH1);
            }
            if(Type == POSITION_TYPE_SELL && WPValH1 > WPPrevValH1)
            {
               m_trade.PositionClose(m_position_ticket);
               Print("WPValH1 = ",(string)WPValH1," WPPrevValH1 = ",(string)WPPrevValH1);
            }

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.

            if(ugolWPR > -90 && ugolWPR < -Ugol && WPValH1 < sellLevel && WPValH1 < WPPrevValH1 /*&& WPValH1 < WPPrevValH1*/)
            {
                //Print("ugolWPR = ", IntegerToString(ugolWPR), " resultat = ", IntegerToString(resultat));
                if (m_trade.Sell(LotSize,Symbol(),ask0,NULL,NULL,NULL)) // класс CTrade сам открывает позицию, если она упомянута

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.
Files:
 
maxvoronin74 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.

This is not an MQL problem, it is a problematic brokerage centre.

 
Alexey Viktorov #:

This is not an MQL problem, it's a problematic DC.

What do you mean, broker?
 
Is there any way to determine how much memory a certain indicator uses?
 
Pls i need to know if the payments for the vps plan for 6 months or 12 months would be taken on installment each month for the period of time or if it is a one time payment of the total amount 
Reason: