0
votes

I'm making a custom indicator. I want to show theoretical brake out lines. So like, straight horizontal line segments. At the moment I have it working, using the semantics of DRAW_SECTION, except - obviously - all my segments are connected.

Is there a way to hide sections of the line that I don't need?
Or is there a better way to do it?

2

2 Answers

0
votes

Two scenarios:

1.

SetIndexStyle( i, DRAW_NONE ); where i is the number of your buffer.

2.

#property indicator_buffers 3
IndicatorBuffers(4);
where
3 is a number of buffers to display,
4 is a total number of buffers. Even though you cannot see the buffer line on the chart, it is still accessed by iCustom( _Symbol, 0, indicator_name, ..., 3, shift );
where 3 is a zero-based reference to the buffer #4.

0
votes

There is a way in MQL4 Indicators :

As documented, there is a special value == EMPTY_VALUE to serve exactly this purpose.

The EMPTY_VALUE constant usually corresponds to the values of indicators that are not shown in the chart.

Just assign, where plausible in your indicator code - either per-bar in assignment BreakOutBUFFER[i] = ( isHereBreakOut( i ) ) ? aLevel : EMPTY_VALUE;
or
by a pre-initialised ArrayInitialize( BreakOutBUFFER, EMPTY_VALUE ); and re-assigning only those cells, where your BreakOut-logic is POSACK'd, yet this is not a preferred way, as the first sooner-or-later coming ( automatic or not ) ArrayResize() will extend this Buffer, as documented:

... the elements will be added at the end of the array, their values will be undefined and in most cases will not be equal to init_value.

but .... not with the pre-set EMPTY_VALUE initialiser...


My option is, obviously, to go the former way