
04-27-2006, 03:10 AM
|
|
Member
|
|
Join Date: Mar 2006
Posts: 33
|
|
|
iCUSTOMS EXPERT ADVISOR DEMO
Quote:
|
Originally Posted by codersguru
Hi homi,
Let’s assume we want to return the value of the indicator “Supertrend” of a specific bar using iCustom.
If we want to get the returned value of the Supertrend first line:
We can write this price of code inside start() function:
Code:
double val=iCustom(NULL, 0, "SuperTrend",0,0,pos);
Here val will hold the returned value of Supertrend indicator(first line).
If you want the returned value of the second line, we can write:
Code:
double val=iCustom(NULL, 0, "SuperTrend",0,1,pos);
This is a program which will use Supertrend indicator using iCustom:
Code:
#property copyright "Coders Guru"
#property link "http://www.forex-tsd.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
int start()
{
int counted_bars=IndicatorCounted();
//---- check for possible errors
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;
int pos=Bars-counted_bars;
while(pos>=0)
{
ExtMapBuffer1[pos] = iCustom(NULL, 0, "SuperTrend",0,0,pos);
ExtMapBuffer2[pos] = iCustom(NULL, 0, "SuperTrend",0,1,pos);
pos--;
}
//----
return(0);
}
//+------------------------------------------------------------------+

|
Hi
Can we get one of these for experts too thanks.
Doc
|