Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 767

 
Ghabo:

Thank you. Help me get a signal. The indicator has 3 buffers zero always full, colour black, first buffer blue, second red. need a signal when there is no black line, it is always at colour change. I understand downloading, installing, time consuming, but very interesting how this is done and no code.

You get the colour buffer data, you don't touch the black buffer.

Check buffer data easily

If blue buffer is not equal toEMPTY_VALUE, it is being drawn now, so the red buffer will be equal to EMPTY_VALUE

and vice versa...

 
Vladimir Pastushak:

You get the coloured buffer data...

This is what I do, but I need to get a signal when there is no black line. Visually, the line appears at the junction of red and blue, but in fact the black buffer is always full. Filled at the same time 2 buffers are always, or 0 and 1 colour blue, or 0 and 2 colour red, but sometimes filled with 0 and 1 or 0 and 2 and colour c...ca black. This is the moment I want to catch, to exclude the signal at this time.

dlshg

 
Ghabo:

This is what I do, but I need to get a signal when there is no black line. Visually, the line appears at the junction of red and blue, but in fact the black buffer is always full. Filled at the same time 2 buffers are always, or 0 and 1 colour blue, or 0 and 2 colour red, but sometimes filled with 0 and 1 or 0 and 2 and colour c...ca black. This is the point I want to catch, to exclude the signal at this time.


I have given you the answer, check the colour buffers for values...

 
Vladimir Pastushak:

I gave you the answer, check the coloured buffers for values...

Perhaps I am not making myself clear. With the same buffer values, the graph can have different line colours. That is, the first buffer is not empty - the colour is blue, but sometimes the first buffer is not empty - the colour is black.

 
Ghabo:

Perhaps I am not making myself clear. If the buffers are the same, the line colour can be different in the graph. That is, the first buffer is not empty - the colour is blue, but sometimes the first buffer is not empty - the colour is black.

black is no colour.

Reject and work with coloured buffers...

 
Vladimir Pastushak:

black is no colour.

No colour is clrNONE and the indicator is clearly clrBlack

How else but like this?

BUY_1=NormalizeDouble(iCustom(NULL,0,"4X Pip Snager Trend",1,1),Digits);//СИНИЙ
if(BUY_1!=EMPTY_VALUE)
{
//ДЕЙСТВИЕ
}
Vladimir Pastushak:

Reject and work with coloured buffers...

 
Vladimir Pastushak:

black is no colour.

Push back and work with colour buffers...

It used to be - black by default. Now, if you don't specify a colour, the indicator is invisible.

 
Ghabo:

Thank you. Help me get a signal. There are 3 buffers in the indicator, zero is always full, colour black, first buffer blue, second red. need a signal when there is no black line, it is always at colour change. I understand, downloading, installing, time consuming, but very interesting how this is done and no code.

Really weirdly written indicator...

Pay attention to the price crossing the indicator line. I put None instead of black


It turns out that if price crosses the indicator line from bottom to top, red changes to blue and vice versa. As for the two extremes, two and four crossings in a row... that's where it gets tricky.

But if you strain your head muscles, you can compose conditions for using this puzzle.

In any case, we should understand that the line is drawn from bar to bar. If we take for example the middle gap, it means that the green bar crossing the line cancels the filling of the red buffer and the colour disappears. Then the next bar fills the blue buffer and the line is drawn from the bar that crossed the price to the current bar.

 
Alexey Viktorov:

A really oddly written indicator...

Thank you. My muscles are not enough) To fix the moment of change of colour red to blue is not difficult, but how to know that at this time, the blue line is covered with black, I have no idea. What condition should be added to it:-

        BUY_1=NormalizeDouble(iCustom(NULL,0,"4X Pip Snager Trend",1,1),Digits);
        if(iOpen(Symbol(), 0, 1)<=BUY_1&&iClose(Symbol(), 0,1)>BUY_1)
          {
        // ДЕЙСТВИЕ
          }

to exclude the signal when the bar crosses the black line? In your screenshot count the last crossing upwards and do not count the crossing of the previous three bars.

 
Ghabo:

Thank you. My muscles are not enough) It is not difficult to fix the moment when the colour red changes to blue, but how to know that at this time, the blue line is covered by black, I have no idea. What condition should be added to it:-

to exclude the signal when the bar crosses the black line? In your screenshot, count the last crossing upwards and do not count the crossing of the previous three bars.

The blue and red lines are just for illustration. They will hardly be covered by the black line. In contrary, the black line is covered with one blue and one red one.

A line is drawn from the value of the previous bar to the value of the current bar. If one of these bars has no value in the indicator buffer, the line cannot be drawn.

In my opinion, this code is enough to detect the fact that the red buffer is "dead". But if you want, you should also read the blue buffer. There will definitely be a value equal to the black buffer value.

For the middle case in my picture, it is clear that the colour has changed. But for the first one, the left one... crossing from bottom to top, the next bar crossing from top to bottom and again the red buffer continues to fill and display. In the last case the crossing goes back and forth as many as four times.

To be sure, run it in the tester and watch the "fading" moment, when the candle closes or when the price touches the line and "turns off" the colour.

Reason: