MT4language unique with array element assignment?

 

Can anyone tell me how to explicitly assign doubles to arrays elements?

Pardon my ignorance but after 15yrs experience with C/C++ and a week reading the MT4 docs, I just don't get this language.

pls see below


Thanks for any help


#property indicator_separate_window // Indicator is drawn in the main window
#property indicator_buffers 2 // Number of buffers
#property indicator_color1 Blue // Color of the 1st line
#property indicator_color2 Red // Color of the 2nd line

double Buf_0[],Buf_1[]; // Declaring arrays (for indicator buffers)
//--------------------------------------------------------------------
int init() // Special function init()
{
SetIndexBuffer(0,Buf_0); // Assigning an array to a buffer
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);// Line style
SetIndexBuffer(1,Buf_1); // Assigning an array to a buffer
SetIndexStyle (1,DRAW_LINE,STYLE_DOT,1);// Line style
return; // Exit the special funct. init()
}
//--------------------------------------------------------------------
int start() // Special function start()
{
int i, // Bar index
Counted_bars; // Number of counted bars
//--------------------------------------------------------------------
Counted_bars=IndicatorCounted(); // Number of counted bars
i=Bars-Counted_bars-1; // Index of the first uncounted
while(i>=0) // Loop for uncounted bars
{

// Code from Documentation, This works
Buf_0[i]=High[i]; // Value of 0 buffer on i bar
Buf_1[i]=Low[i];


// This doesn't assign anything to separate chart window ?????????
////////////////////////////////////////////////////////////////////
Buf_0[i]=1.5; // Value of 0 buffer on i bar
Buf_1[i]=1.6; // Value of 1st buffer on i bar
///////////////////////////////////////////////////////////////////


i--; // Calculating index of the next bar
}
//--------------------------------------------------------------------
return; // Exit the special funct. start()
}
//--------------------------------------------------------------------

 
abfc:

Can anyone tell me how to explicitly assign doubles to arrays elements?

Pardon my ignorance but after 15yrs experience with C/C++ and a week reading the MT4 docs, I just don't get this language.

pls see below

Works fine for me. Here's the output without Buf_0[i]=1.5; Buf_1[i]=1.6;



And here is the output when using Buf_0[i]=1.5; Buf_1[i]=1.6;



 

Are you compiling your code and then dragging it on to a chart?

Compiling will not change existing indicators already on charts.