Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 8/11/2005(UTC) Posts: 104
|
Hi
Using
fastLength:= 5
slowLength= 35
Adding Signal lines
as positive and negative Moving averages
Code:
fastLength:= Input("fastLength",5,34,5);
slowLength:=Input("slowLength",5,252,35);
dev:=Input("Devations",1,2,1);
data:=(H+L)/2;
factor:=200;
lookback:=150;
AvgFast:=Mov(data,fastLength,S);
AvgSlow:=Mov(data,slowLength,S);
OscValue:= AvgFast - AvgSlow;
{start Breakout Bands logic}
posValue := (OscValue > 0) * OscValue;
posDev:=If(posValue>0,dev*(Stdev(posValue, lookback)),PREV);
negValue := (OscValue < 0) * Abs(OscValue);
negDev := If(negValue > 0, dev*(Stdev(negValue, lookback)),PREV);{End Breakout Bands logic}
UpperBand:=factor/100 * posDev;
LowerBand:= -factor/100 * negDev;
OscValue1:=OscValue;
MAPos:=Input("MA-Pos",2,200,9);
MANeg:=Input("MA-Neg",2,200,9);
PosNegMA:=If(OscValue>=0,Mov(OscValue,MAPos,S)
,Mov(OscValue1,MAneg,S));
{plot}
OscValue;
OscValue1;
UpperBand; LowerBand;
PosNegMA;
http://i.imgur.com/sTfXECK.jpg
"> http://i.imgur.com/sTfXECK.jpg
|