{
Indicator: _Avg$Traded AvgDollarsTraded (for Charts)
Purpose: Display average of Total number of dollars traded on each bar (Closing Price X Bar Volume)
if Daily, Weekly or Monthly Chart, average dollars traded are in Millions (x $1,000,000)
if Intraday Chart (minutes), average dollars traded are in Thousands (x $1,000)
Does not work with tick charts.
Author: MarkSanDiego
Updated: 06/09/07
01/07/08 added ratio of average dollars traded
03/08/08 code improved
01/31/10 posted to forum
11/26/10 efficient improved by using _DollarsTraded instead of _AvgDollarsTraded
01/29/11 version 9.0 update
}
Inputs:
Length1(10), { number of bars in short moving average of dollars traded daily }
Length2(50), { number of bars in long moving average of dollars traded daily }
Min$(0.5), { liquidity minimum in average dollars traded per day (Millions) }
Color1(white), { color of average dollars traded in Length1 bars }
Color2(cyan), { color of average dollars traded in Length2 bars }
RatioColor(yellow), { color of ratio of fast (Length1) and slow (Length2) moving dollars traded daily }
DollarsTradedColor(darkgray), { color of bar chart of Dollars Traded }
RatioAlertValue(2), { short to long volume ratio value at which color of plot changes and alert is trigered }
Low$Color(Red), { color used to highlight dollars traded when less than user specified minimum: Min$ }
RatioAlertColor(green), { color used to plot short over long volume ratio }
ShowAvg$Traded(True), { if True, indicator plot will Average $Traded }
Show$Traded(False), { if True, plot dollars traded each bar }
ShowRatio(False), { show ratio of dollars traded averages }
PlotWidth(1), { width of line plotted }
Ref(0); { reference value to draw on chart. Plots only if non zero. For zero line, use }
{ a number very close to zero, such as 0.00001 }
vars:
adt1(0),
adt2(0),
DollarsTraded(0), { dollars traded }
Ratio(0),
RatioColor2(RatioColor),
DollarsTradedColor2(white),
Intraday(IntervalType = 1);
DollarsTraded = _DollarsTraded;
if length1 > 0 then adt1 = _AverageFC(DollarsTraded, Length1);
if length2 > 0 then adt2 = _AverageFC(DollarsTraded, Length2);
if ShowAvg$Traded then begin
if Intraday then begin
Plot1(adt1,"Avg 1 ($K)", iff(adt1 < Min$, Low$Color, Color1), default, PlotWidth);
Plot2(adt2,"Avg 2 ($K)", iff(adt2 < Min$, Low$Color, Color2), default, PlotWidth);
end else begin
Plot3(adt1,"Avg 3 ($Mil)", iff(adt1 < Min$, Low$Color, Color1), default, PlotWidth);
Plot4(adt2,"Avg 4 ($Mil)", iff(adt2 < Min$, Low$Color, Color2), default, PlotWidth);
end;
end;
if adt2 <> 0 then begin
Ratio = adt1/adt2;
if Ratio > RatioAlertValue then begin
Alert("Volume Ratio High");
RatioColor2 = RatioAlertColor;
DollarsTradedColor2 = green{RatioAlertColor};
end else begin
RatioColor2 = RatioColor;
DollarsTradedColor2 = DollarsTradedColor;
end;
if ShowRatio then Plot5(Ratio, "$ Ratio", RatioColor2, default, PlotWidth);
end;
If Show$Traded then begin
if Intraday then begin
plot6(DollarsTraded, "$Traded $K", DollarsTradedColor2);
end else begin
plot7(DollarsTraded, "$Traded $Mil", DollarsTradedColor2);
end;
end;
if Ref <> 0 then Plot8(Ref, "Ref");