I want to put Close[0] into buffer.

To add comments, please log in or register
Cromo
259
Cromo  

I want to put Close[0] price value into buffer.

I coded.

#property strict   
#property indicator_buffers 1
double Buffer[];


int OnInit()
  {
    SetIndexBuffer(0,Buffer);
}


void OnTimer()
  {  
   Buffer[0]=Close[0];
}


But when I checked buffer1 , it is EMPTY_VALUE.

What am I missing?

Keith Watford
Moderator
20423
Keith Watford  
kajironpu:

I want to put Close[0] price value into buffer.

I coded.

But when I checked buffer1 , it is EMPTY_VALUE.

What am I missing?

You don't have a buffer 1.

You only have 1 buffer and that is buffer 0

Cromo
259
Cromo  
Keith Watford:

You don't have a buffer 1.

You only have 1 buffer and that is buffer 0

Thank you , Keith

Is this correct?

#property strict   
#property indicator_buffers 1
double Buffer[];


int OnInit()
  {
    SetIndexBuffer(1,Buffer);
}


void OnTimer()
  {  
   Buffer[1]=Close[0];
}
Keith Watford
Moderator
20423
Keith Watford  
kajironpu:

Thank you , Keith

Is this correct?

Sorry, I must have mis-read your post, I thought that you were trying to access Buffer 1, not Buffer[1].

How are you checking the value?

Cromo
259
Cromo  
Keith Watford:

Sorry, I must have mis-read your post, I thought that you were trying to access Buffer 1, not Buffer[1].

How are you checking the value?

Keith, Thanks

Now I am clear and made success.

#property indicator_buffers 1

This is for Number of buffer.

If I use only one buffer, I made 1.

Now it is OK with me.

Thank you for your kind replay.

To add comments, please log in or register