Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 8/11/2005(UTC) Posts: 104
|
Code:
{ User inputs }
NPeriod :=Input("Bands Channel's Periods", 1,252,20);
BBStdDev :=Input("Bollinger Bands Deviation",.001,10,2);
KTStdDev :=Input("Keltner Bands Deviation",0.0,10,1.5);
MoPeriod :=Input("Momentum Periods",1,50,12);
MoEMA :=Input("Momentum EMA Periods",1,20,5);
{Bollinger Bands}
HBLine := BBandTop( C, NPeriod, E, BBStdDev);
LBLine := BBandBot( C, NPeriod, E, BBStdDev);
{Keltner Bands}
HKLine := Mov(C,NPeriod,S) + KTStdDev * ATR(NPeriod);
LKLine := Mov(C,NPeriod,S) - KTStdDev * ATR(NPeriod);
MoHist := Mov((C - Ref(C,-MoPeriod)),MoEMA, E);
BBUp := If((HBLine > HKLine) AND (MoHist > 0), MoHist, 0);
BBDo := If((LBLine < LKLine) AND (MoHist < 0), MoHist, 0);
BBMid1:= If((BBUp = 0) AND (BBDo = 0) AND (MoHist > 0), MoHist, 0);
BBMid2:= If((BBUp = 0) AND (BBDo = 0) AND (MoHist < 0), MoHist, 0);
BBUp {Histogram - Blue};
BBDo {Histogram - Red};
BBMid1 {Histogram - Gray};
BBMid2 {Histogram - Brown};
|