Hi,
does anyone now, how can i generate an moving average an indicator (generated with iCustom) ?
***********************************************************************
//--------------------------------------------------------------------
// Default Indicator - http://book.mql4.com/samples/icustom
//--------------------------------------------------------------------
#property indicator_separate_window // Indicator is drawn in the main window
#property indicator_buffers 1 // Number of buffers
#property indicator_color1 Orange // Color of the 1st line
double Buf0[];
// Declaring arrays (for indicator buffers)
//--------------------------------------------------------------------
int init() // Special function init()
{
SetIndexBuffer(0,Buf0); // Assigning an array to a buffer
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);// Line style
;
return(0); // 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
{
Buf0[i]= Close[i] - (iCustom(NULL,0,"Indi1",0,i) - iCustom(NULL,0,"Indi1",1,i) ) ; // Value of 0 buffer on i bar
// Value of 1st buffer on i bar
i--; // Calculating index of the next bar
}
//--------------------------------------------------------------------
return(0); // Exit the special funct. start()
}
//--------------------------------------------------------------------
does anyone now, how can i generate an moving average an indicator (generated with iCustom) ?
***********************************************************************
//--------------------------------------------------------------------
// Default Indicator - http://book.mql4.com/samples/icustom
//--------------------------------------------------------------------
#property indicator_separate_window // Indicator is drawn in the main window
#property indicator_buffers 1 // Number of buffers
#property indicator_color1 Orange // Color of the 1st line
double Buf0[];
// Declaring arrays (for indicator buffers)
//--------------------------------------------------------------------
int init() // Special function init()
{
SetIndexBuffer(0,Buf0); // Assigning an array to a buffer
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);// Line style
;
return(0); // 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
{
Buf0[i]= Close[i] - (iCustom(NULL,0,"Indi1",0,i) - iCustom(NULL,0,"Indi1",1,i) ) ; // Value of 0 buffer on i bar
// Value of 1st buffer on i bar
i--; // Calculating index of the next bar
}
//--------------------------------------------------------------------
return(0); // Exit the special funct. start()
}
//--------------------------------------------------------------------