I want to put Close[0] into buffer.

 

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?

 
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

 
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];
}
 
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?

 
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.

Reason: