PS Bull Power Bear Power 4 w TADP

This is the place to discuss EdgeRater Chart Script

Moderator: Chris White

Post Reply
henry1224
Posts: 457
Joined: Wed Feb 24, 2016 12:04 pm

PS Bull Power Bear Power 4 w TADP

Post by henry1224 »

ML1:=MA(Close,50);
ML2:=MA(Close,200);
RecP:= If((ML1 < ML2 & Close < ML2 & Close > ML1) ,1,0),ColorLightGreen;
WarnP:= If((ML1 > ML2 & Close > ML2 & Close < ML1) ,-1,0),ColorOrange;
AcumP:= If((ML1 < ML2 & Close > ML2 & Close > ML1) ,2,0),ColorGreen;
DispP:= If((ML1 > ML2 & Close < ML2 & Close < ML1) ,-2,0),ColorRed;
BullP:= If((ML1 > ML2 & Close > ML2 & Close > ML1) ,3,0),ColorDarkGreen;
BearP:= If((ML1 < ML2 & Close < ML2 & Close < ML1),-3,0),ColorDarkRed;
TD:=(RecP + WarnP + AcumP + DispP + BullP + BearP);
bear1:=(L-EMA(C,13))>Ref((L-EMA(C,13)),1) & Ref((L-EMA(C,13)),1)<Ref((L-EMA(C,13)),2);
bull1:=(H-EMA(C,13))<Ref((H-EMA(C,13)),1) & Ref((H-EMA(C,13)),1)>Ref((H-EMA(C,13)),2);
Val1:= Ref((L-EMA(C,13)),1);
Val2:= Ref((H-EMA(C,13)),1);
A:=ValueWhen(Val1,bear1,1) > ValueWhen(Val1,Bear1,2) & BarsSince(bear1)<BarsSince(bull1);
B:= ValueWhen(Val2,Bull1,1) < ValueWhen(Val2,Bull1,2) & BarsSince(bear1)>BarsSince(bull1);
Long:BarsSince(A)<BarsSince(B) & TD>0,ColorGreen;
Short:BarsSince(A)>BarsSince(B) & TD<0,ColorRed;
FillRgn(Long>0,0,Long),Brush#50008000;
FillRgn(Short>0,0,Short),Brush#50800000;
Post Reply