Errors, bugs, questions - page 1219

 
 
sanyooooook:

Checked it, it's not working.

And the bar is more informative as it is. I'd like to think it's a fixable bug and not another innovation.

 
Silent:

Checked it, it's not working.

And the bar is more informative. I'd like to think it's a fixable bug and not another innovation.

Yeah, it wouldn't be convenient without it.
 

Good afternoon. Can you please tell me if the indicator can draw the following things: there is a line, it is drawn, for example, according to the prices of candlesticks maximums. Then, the time comes when this line is no longer drawn (EMPTY_VALUE values). Then comes the moment when the line should be drawn again. That would be fine, but the end of the previous line is connected to the start of the current line. Question: is there any way to avoid this, i.e. to prevent lines from being joined? And what do I need to do/use for that?

P.S. As far as I understand, each drawing style connects non-empty values. Then the gaps are always connected. But maybe I missed something...?

 
Tapochun:

Good afternoon. Can you please tell me if the indicator can draw the following things: there is a line, it is drawn, for example, according to the prices of candlesticks maximums. Then, the time comes when this line is no longer drawn (EMPTY_VALUE values). Then comes the moment when the line should be drawn again. That would be fine, but the end of the previous line is connected to the start of the current line. Question: is there any way to avoid this, i.e. to prevent lines from being joined? And what do I have to do/use for that?

P.S. As far as I understand, each drawing style connects non-empty values. Then the gaps are always connected. But maybe I missed something...?

You can use more than one buffer for a line - you can change the buffer number at the next transition.

Depending on the situation, you may need 2 to 3 buffers in total. 3 when a segment can consist of 2 candles.

(here is a very good article - might be useful)

To reduce the number of buffers, I personally switched to graphical objects - saving line values into one common non-indicator buffer.

But with this approach, you have to remember to delete objects even before you start - because when you save the pattern, all objects on the chart are also saved.

Конструктор трейдера: Украшение индикаторов - Статьи по MQL4
  • www.mql5.com
Конструктор трейдера: Украшение индикаторов - Статьи по MQL4: особенности автоматических торговых стратегий
 
Tapochun:

Good afternoon. Can you please tell me if the indicator can draw the following things: there is a line, it is drawn, for example, according to the prices of candlesticks maximums. Then, the time comes when this line is no longer drawn (EMPTY_VALUE values). Then comes the moment when the line should be drawn again. That would be fine, but the end of the previous line is connected to the start of the current line. Question: is there any way to avoid this, i.e. to prevent lines from being joined? And what do I have to do/use for that?

P.S. As far as I understand, each drawing style connects non-empty values. Then the gaps are always connected. But maybe I missed something...?

Files:
nb8dma.mq5  4 kb
 
ALXIMIKS:

it is possible to use more than one buffer for a line - change the buffer number at the next crossing.

Depending on the situation a total of 2 to 3 buffers may be needed. 3 when a segment can consist of 2 candles.

(here is a very good article - might be useful)

To reduce the number of buffers, I personally switched to graphical objects - saving line values into one common non-indicator buffer.

But with this approach, you have to remember to delete objects even before you start - because when you save the template, all objects on the chart are also saved.

ALXIMIKS, thanks for the reply. Not really suited to the options you suggested, here's why:

1. In my opinion, having 2-3 buffers to draw one line is not a good idea. Even after data transfer by one line to one buffer and by second line to second buffer, you will face a situation where you will have to use first buffer again and the lines will still connect first to third (if you set EMPTY_VALUE for empty value, as I did);

2. I have read the article suggested by you. The ideas suggested in it are implemented much more efficiently now (after MQL4/5 update), thanks to new language features;

3. About the use of graphical objects. The use of indicator buffers is more convenient than the saving of values into the nonindicator buffer. In my opinion, it will also be easier to use lines from the Expert Advisor.

4.MigVRN's post below is the best option, I think.

 
MigVRN:

Thanks, that's just what I need! It's a pity the help doesn't say that initializing with zero gets rid of glues (with DRAW_LINE style).
 
Tapochun:
Thanks, that's what I need! It's a pity the help doesn't say, that zero initialization eliminates glues (for DRAW_LINE style).

In the help it says about the DRAW_FILLING style. I just thought it was the same in DRAW_LINE style. Better look in help about DRAW_FILLING- it doesn't have to initialize with zero. I understand by any value that is pre-set as empty.

   #define  INDICATOR_EMPTY_VALUE -1.0
   ...
//--- значение INDICATOR_EMPTY_VALUE (пустое значение) не будет участвовать в расчете
   PlotIndexSetDouble(индекс_построения_DRAW_FILLING,PLOT_EMPTY_VALUE,INDICATOR_EMPTY_VALUE);
 
MigVRN:

In the help it says about the DRAW_FILLING style. I just thought it was the same in DRAW_LINE style. Better look in help about DRAW_FILLING- it doesn't have to initialize with zero. I understood it as any value which is pre-set as empty.

I've never reviewed DRAW_FILLING, because only DRAW_LINE and DRAW_SECTION logically suit me. But, in these styles, when setting an empty value

PlotIndexSetDouble( 0, PLOT_EMPTY_VALUE, EMPTY_VALUE );

just the empty values of two adjacent lines are connected, which is not required. However, if you do it the way you suggest:

PlotIndexSetDouble( 0, PLOT_EMPTY_VALUE, 0 );

The DRAW_LINE style does what you want, and the DRAW_SECTION style does not, but DRAW_SECTION's help says that two non-empty values are joined! Any other values in DRAW_LINE instead of 0 will result in gluing. In DRAW_SECTION, any value in place of a blank one will still result in gluing. Apparently DRAW_FILLING is built on a different principle.

Reason: