How is this physically possible? - page 3

To add comments, please log in or register
Marco vd Heijden
Moderator
8628
Marco vd Heijden  

What do you think will happen when you set a linebuffer to zero ? 

Have you scrolled down to see where the lines ends ?

I find this topic just laughable.

Alain Verleyen
37174
Alain Verleyen  
koranged:

Ah. I wasn't aware of this function. By 'initialise' I thought you meant using SetIndexBuffer in OnInit(). 

The documentation states that "The function initializes a numeric array by a preset value." - why do we need to do this? I apoligise if my questions sound silly, I understand that this is probably why my program is failing but I just don't really understand how setting all the elements to empty value 'initialises' the array. Would you mind explaining this a bit further? Again I apologise if my question sounds silly I just can't really get my head around it. Thanks.

SetIndexBuffer() is to associate an array with an indicator buffer, that means your array will be used to draw on the chart and will be automatically resized.

But then you have the responsibility to set the array values correctly. EMPTY_VALUE means nothing is drawn. As I already explained you, when you declare an array (a buffer), you reserve the memory, but when the values in this memory are unchanged (not initialized), these values can't be anything depending of your computer usage and resources available.

So you HAVE TO initialize explicitly your buffers (arrays), what I showed you is just a way, it's not mandatory to do it this way, but it's the easiest way. The main thing as that each value of a buffer need to be set. An indicator buffer is by definition sized to the entire chart candles, but in your code you started to set value from Limit_1, Limit_2, Limit_3, so the values before that were never set.

I will let you find why you have these 3 lines going to bottom with the help of Marco.

Alain Verleyen
37174
Alain Verleyen  
Marco vd Heijden:

What do you think will happen when you set a linebuffer to zero ? 

Have you scrolled down to see where the lines ends ?

I find this topic just laughable.

Marco I am trying to help someone who is ready to learn and work by himself, I don't see what is laughable.

Is this a way to post for a moderator ? Please act as a moderator.

Please explain to koranged why the first value drawn for each buffer is 0 ?

Marco vd Heijden
Moderator
8628
Marco vd Heijden  
Alain Verleyen:

Marco I am trying to help someone who is ready to learn and work by himself, I don't see what is laughable.

Is this a way to post for a moderator ? Please act as a moderator.

Please explain to koranged why the first value drawn for each buffer is 0 ?

Stop telling me what to do.

Every time he writes zero to the buffer it obviously draws the line down to zero.

It's not rocket science.

koranged
450
koranged  
Alain Verleyen:

Marco I am trying to help someone who is ready to learn and work by himself, I don't see what is laughable.

Is this a way to post for a moderator ? Please act as a moderator.

Please explain to koranged why the first value drawn for each buffer is 0 ?

Managed to get the program running in the end through combination of proper array initialisation and using PLOT_DRAW_BEGIN from the first required bar. Thanks again for all your input and help.

123
To add comments, please log in or register