This is coded in tradestation, easy to configure to other platforms...
{ TrendArea_2 Indicator WAV 9/15/04
9/16/04 added FastLen and SlowLen inputs
}
inputs: ThresholdArea(25),FastLen(13),
SlowLen(30);
vars: BarCount(0),SlowMA(0),FastMA(0),
color(0),area(0);
SlowMA = xaverage(close,SlowLen);
FastMA = xaverage(close,FastLen);
{ see if we have a new possible trend starting }
if FastMA crosses above SlowMA or
FastMA crosses below SlowMA then
BarCount = 0;
BarCount = BarCount + 1;
{ multiply each individual area by its barcount }
area = BarCount * (FastMA - SlowMA);
color = IFF(area > area[1] and area > 0,green,yellow);
if color = yellow and area < area[1] then
color = DarkGreen;
color = IFF(area < area[1] and area < 0,red,color);
if color = yellow and area > area[1] then
color = DarkRed;
plot1(area,"Area",color);
plot2(0,"zero line");
basically it is the number of bars since the crossover multiplied by the difference of the fast and slow moving averages.
{ TrendArea_2 Indicator WAV 9/15/04
9/16/04 added FastLen and SlowLen inputs
}
inputs: ThresholdArea(25),FastLen(13),
SlowLen(30);
vars: BarCount(0),SlowMA(0),FastMA(0),
color(0),area(0);
SlowMA = xaverage(close,SlowLen);
FastMA = xaverage(close,FastLen);
{ see if we have a new possible trend starting }
if FastMA crosses above SlowMA or
FastMA crosses below SlowMA then
BarCount = 0;
BarCount = BarCount + 1;
{ multiply each individual area by its barcount }
area = BarCount * (FastMA - SlowMA);
color = IFF(area > area[1] and area > 0,green,yellow);
if color = yellow and area < area[1] then
color = DarkGreen;
color = IFF(area < area[1] and area < 0,red,color);
if color = yellow and area > area[1] then
color = DarkRed;
plot1(area,"Area",color);
plot2(0,"zero line");
basically it is the number of bars since the crossover multiplied by the difference of the fast and slow moving averages.