SetIndexBuffer()

 

The tooltip says:

Using SetIndexBuffer() the tooltip says:

[1 of 2] bool SetIndexBuffer(int buffer_num,double&double_array[],ENUM_INDEXBUFFER_TYPE buffer_mode=INDICATOR_DATA)

What is the 1 of 2 refering to and what is the ENUM_INDEXBUFFER_TYPE .... parameter ? The docs I have don't mention a third parameter in SetInddexBuffer()

 

OIC ... its the mql5 way of doing it ..

So if I were to do SetIndexBuffer(0,Buffer,INDICATOR_DATA) does that mean I am now locked into doing other things mql5 style ? Or are mql5 and mql4 functions now integrated to the extent where they are interchangable across the board ?

 
SDC:

The tooltip says:

Using SetIndexBuffer() the tooltip says:

[1 of 2] bool SetIndexBuffer(int buffer_num,double&double_array[],ENUM_INDEXBUFFER_TYPE buffer_mode=INDICATOR_DATA)

What is the 1 of 2 refering to and what is the ENUM_INDEXBUFFER_TYPE .... parameter ? The docs I have don't mention a third parameter in SetInddexBuffer()

[1 of 2] means there is variant available. By pressing up/down key you can go from 1 to 2 and vice-versa. Documentation of SetIndexBuffer() doesn't seem to be updated yet.

AFAIK, you can use both (old and new from mql5), but I haven't tried yet if it's well working.

See documentation for ENUM_INDEXBUFFER_TYPE.

 
angevoyageur:

[1 of 2] means there is variant available. By pressing up/down key you can go from 1 to 2 and vice-versa. Documentation of SetIndexBuffer() doesn't seem to be updated yet.

AFAIK, you can use both (old and new from mql5), but I haven't tried yet if it's well working.

See documentation for ENUM_INDEXBUFFER_TYPE.


Thanks for the tip I didnt know about the up/down key. Do you think there is a performance advantage in using mql5 functions in mql4 indicators or no ? For example using rates_previous/rates_total to write a loop as opposed to Bars/IndicatorCounted() ...
 
SDC:
Thanks for the tip I didnt know about the up/down key. Do you think there is a performance advantage in using mql5 functions in mql4 indicators or no ? For example using rates_previous/rates_total to write a loop as opposed to Bars/IndicatorCounted() ...
Sorry I don't know, we have to test it. My guess is it can be an advantage as you have variables with mql5 and functions with mql4. I don't have time to make this test, do you have it ?
 
SDC: Do you think there is a performance advantage in using mql5 functions in mql4 indicators or no ? For example using rates_previous/rates_total to write a loop as opposed to Bars/IndicatorCounted() ...
  1. There is likely a performance advantage with mql5's handle to indicators, but can they aren't in the mt4 documentation: https://docs.mql4.com/indicators/iCustom I'd use just the mt4 version https://docs.mql4.com/customind/SetIndexBuffer
  2. I posted my read on rates_total https://www.mql5.com/en/forum/149695
 

Thanks I read your post on rates_total I am going to experiment a little with indicator loops, The new SetIndexBuffer() is useful, you can use the enumerator to set the buffer as a drawing or calculating buffer there is a third enum to set it as a color I'm not sure to the purpose of a color buffer though.

 
SDC:

Thanks I read your post on rates_total I am going to experiment a little with indicator loops, The new SetIndexBuffer() is useful, you can use the enumerator to set the buffer as a drawing or calculating buffer there is a third enum to set it as a color I'm not sure to the purpose of a color buffer though.

If you need a multicolored line for example, instead of having a buffer for each color, you can have 1 buffer for data and 1 buffer for color. See this article for example.
Reason: