Page 1 of 1

Mean-Reversion from May TASC

Posted: Mon Apr 29, 2019 7:34 am
by henry1224
Here is the code from the May TASC Mean-Reversion

Under the parameter tab

LN1 Double 10 0 100
LN2 Double 100 0 1000


Under the script tab

sma:= MA(c,LN1);
lma:= MA(c,LN2);
dev:= std(c,LN1);
z: (C - sma)/dev,Width2,ColorBlack;
FillRgn(Z<= -1,Z,-1),Brush#5000FF00;
FillRgn(Z>=1,Z,1),Brush#50FF0000;



Here is the code for the long entry

Use the same parameter tab

under the script tab

sma:= MA(c,LN1);
lma:= MA(c,LN2);
dev:= std(c,LN1);
z:= (C - sma)/dev,Width2,ColorBlack;
Event:(z < -1) & (sma > lma),Width2,ColorGreen;


here is the code for the long exit

use the same parameter tab

under the script tab

sma:= MA(c,LN1);
lma:= MA(c,LN2);
dev:= std(c,LN1);
z:= (C - sma)/dev,Width2,ColorBlack;
Event:z > -0.5,Width2,Color Blue;

Here is the code for the sell short

use the same parameter tab

under the script tab

sma:= MA(c,LN1);
lma:= MA(c,LN2);
dev:= std(c,LN1);
z:= (C - sma)/dev,Width2,ColorBlack;
Event:(z > 1) & (sma < lma),Width2,ColorRed;

Here is the code for the short exit

use the same parameter tab

under the script tab

sma:= MA(c,LN1);
lma:= MA(c,LN2);
dev:= std(c,LN1);
z:= (C - sma)/dev,Width2,ColorBlack;
Event:z < 0.5,Width2,ColorViolet;

Re: Mean-Reversion from May TASC

Posted: Mon Jan 18, 2021 9:25 pm
by bsegura
Hey...
Try applying a 55 period Hull Moving Average also looking with Heikin Ashi candle option

your code with modification:

sma:= MA(c,LN1);
lma:= MA(c,LN2);
dev:= std(c,LN1);
z: (C - sma)/dev,Width2,ColorBlack;
FillRgn(Z<= -1,Z,-1),Brush#5000FF00;
FillRgn(Z>=1,Z,1),Brush#50FF0000;

HullMA(z,55),colororange,width3;