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

 
Alexey Viktorov:

Vitaly, it was said about INDICATOR_CALCULATIONS look... It doesn't mean that it definitely works. And then it was said.

Checked!!!


Another option.

And all this on zero bar...

Yes, it really did work.

Thanks for your time!

 
Vitaly Muzichenko:

Yes, it really worked.

Thank you for your time!

Use it, it's not a pity. :))
 
Alexey Viktorov:
Use it, it's not a pity. :))

Is there any way to get them out of here? 4 и 5


 
Vitaly Muzichenko:

Is there any way to get them out of here? 4 и 5


And then assign them to INDICATOR_CALCULATIONS.

#property indicator_buffers 4
   SetIndexBuffer(4, buf4, INDICATOR_CALCULATIONS);
   SetIndexBuffer(5, buf5, INDICATOR_CALCULATIONS);

This is checked, it works too.


And again, as a last resort

#property indicator_buffers 4

and in OnInit()

   IndicatorBuffers(6);

It's an old trick.

 
Alexey Viktorov:

So assign them to INDICATOR_CALCULATIONS

This is checked, it works too.


And again, as a last resort

and in OnInit()

These are old tricks.

Thank you very much!

Option #2 worked fine.

 
Vitaly Muzichenko:

Thank you so much!

Option two worked fine.

And the first one works, too. I just remembered in which indicator I could apply it, looked it up... Yes, it says so.

They must have removed it from mql4 documentation, apparently due to the absence of INDICATOR_COLOR_INDEX all together, without understanding it.

 
Alexey Viktorov:

Yes and the first one works. I just remembered in which indicator I could apply it, looked it up... It is written there.

They may have removed it from mql4 documentation, apparently due to the absence of INDICATOR_COLOR_INDEX all in one go.

Is it possible to draw a two-color line using one buffer instead of two?

  SetIndexStyle(2,DRAW_LINE);
  SetIndexBuffer(2,BufW_Up);

  SetIndexStyle(3,DRAW_LINE);
  SetIndexBuffer(3,BufW_Dn);

I tried DRAW_COLOR_LINE, but it doesn't work in 4, or maybe I'm doing it wrong.

 
Vitaly Muzichenko:

Is there any way to draw a two-colour line using one buffer rather than two, right now it's like this:

I tried DRAW_COLOR_LINE, but it doesn't work in 4, or maybe I'm doing it wrong.

No, they will never do it in mql4. But mql5 also uses 2 buffers for a colored line. A data buffer and a colour buffer. The only difference is that in mql4 with all modifications, both buffers are filled at the colour transition bar. But mql5 has another problem, the INDICATOR_COLOR_INDEX buffer is not available for iCustom(). Or I tried to do something wrong...

 
Alexey Viktorov:

No, mql4 will never do that. But mql5 also uses 2 buffers for a colored line. A data buffer and a colour buffer. The only difference is that in mql4 with all modifications, both buffers are filled at the colour transition bar. But mql5 has another problem, the INDICATOR_COLOR_INDEX buffer is not available for iCustom(). Or I tried to do something wrong...

I see, so I'll leave it as it is in the fourth. I'll write one less buffer in five.

Thank you!

 
Alexey Viktorov:

But mql5 has another problem, INDICATOR_COLOR_INDEX buffer is not available for iCustom(). Or I tried to do something wrong...

Everything was available, as far as I remember.
Reason: