#property indicator_buffers 3
#property indicator_chart_window
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Red
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
//draw buffers
double up[];
double md[];
double dn[];
//count buffers
double res[];
double sup[];
int init()
{
//---- indicators
IndicatorBuffers(5);
SetIndexBuffer(0,up);
SetIndexBuffer(1,md);
SetIndexBuffer(2,dn);
SetIndexBuffer(3,res);
SetIndexBuffer(4,sup);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2);
SetIndexShift(0,1);
SetIndexShift(1,1);
SetIndexShift(2,1);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) counted_bars=0;
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i=limit;i>=0;i--)
{
sup = C_Sup11(i);
res = C_Res11(i);
}
for(i=limit;i>=0;i--)
{
up = iMAOnArray(res,0,3,0,MODE_SMA,i);
md = C_PL_Dot(i);
dn = iMAOnArray(sup,0,3,0,MODE_SMA,i);
}
//----
return(0);
}
//+------------------------------------------------------------------+
double C_PL_Dot(int i)
{
double Result = (
((High[i+1] + Low[i+1]+Close[i+1]) / 3) +
((High[i+2] + Low[i+2]+Close[i+2]) / 3) +
((High + Low+Close) / 3)
) / 3;
return (NormalizeDouble(Result,4));
}
double C_dot11(int i) /* 1-1 Dot */
{
double Result = (High + Low + Close)/3;
return (NormalizeDouble(Result,4));
}
double C_Res11(int i) /* 1-1 High */
{
double Result = (C_dot11(i) * 2) - Low;
return (NormalizeDouble(Result,4));
}
double C_Sup11(int i) /* 1-1 Low */
{
double Result = (C_dot11(i) * 2) - High;
return (NormalizeDouble(Result,4));
}