Wednesday, 23 October 2019

Volume for Amibroker (AFL)





_SECTION_BEGIN("Simple Volume");
SetChartOptions(0,chartShowArrows|chartShowDates);
GfxSetBkMode(1);

_SECTION_BEGIN ("?????");
BarsColor = ParamList ("Bars Color", "By Price|Mono|By Volume|By Bull and Bears");
HistWidth = Param("??????? ??????????", -30, -60, 0, 10);

BullCond  = V>Ref(V,-1) AND C>Ref(C,-1) OR V<Ref(V,-1) AND C<Ref(C,-1);
BearCond  = V>Ref(V,-1) AND C<Ref(C,-1) OR V<Ref(V,-1) AND C>Ref(C,-1);
BuBeColor = IIf(BullCond, colorBrightGreen, IIf( BearCond, colorRed, colorLightYellow));

if      (BarsColor == "Mono")            { BarColors=colorSkyblue; Txt = "Mono"; }
else if (BarsColor == "By Price")        { BarColors=IIf(C==O, colorWhite, IIf(C>O, colorBrightGreen, colorRed)); Txt="By Price"; }
else if (BarsColor == "By Volume")        { BarColors=IIf(V==Ref(V,-1), colorWhite, IIf(V>Ref(V, -1), colorBrightGreen, colorRed));  Txt="By Volume"; }
else if (BarsColor == "By Bull and Bears")    { BarColors=BuBeColor; Txt = "By Bull and Bears";}

SetBarFillColor(BarColors);
Plot(V,"Volume "+ Txt, BarColors, styleHistogram, Null, Null,  1, HistWidth);
VL    = LastValue(Volume);
VLCol = LastValue(BarColors);
//Plot(EndValue(Volume), "", VLCol, styleLine|styleNoLabel, Null, Null,0,10);

VAv = MA(V, Param("MA Period", 30, 10, 400, 10));
Plot(VAv, "Average Volume", colorYellow, styleThick);
PlotOHLC(0,VAv,0,VAv, "",  colorBlack, styleCloud|styleNoLabel);
_SECTION_END();

No comments:

Post a Comment

Thanks