Rank: Member
Groups: Registered, Registered Users Joined: 11/4/2005(UTC) Posts: 10 Location: Sydney, Australia
|
Hi Jose,
Unfortunately the cut and paste of both the formulae as indicated below did not plot as it has errors which my very limited Metastock knowledge is unable to resolve.
[code:1:4fd324329a]{ True Strength Index (TSI) v2.0
©Copyright 2003~2005 Jose Silva.
The grant of this license is for personal use
only - no resale or repackaging allowed.
All code remains the property of Jose Silva.
http://www.metastocktools.com }
{ User inputs }
pdsRoc:=Input("ROC periods",1,252,3);
pdsEma:=Input("EMA periods",1,252,5);
smooth:=Input("smoothing EMA periods",1,252,21);
{ TSI }
TSI:=100*
Mov(Mov(ROC(C,pdsRoc,%),pdsEma,E),smooth,E)/
Mov(Mov(Abs(ROC(C,pdsRoc,%)),pdsEma,E),smooth,E);
avg:=Cum(TSI)/Cum(IsDefined(TSI));
{ Auto over-Bought/Sold levels }
pk:=Ref(TSI,-1)=HHV(TSI,3) AND TSI>0;
pkVal:=ValueWhen(1,pk,Ref(TSI,-1));
Obought:=Cum(pkVal*pk)/Cum(pk);
tr:=Ref(TSI,-1)=LLV(TSI,3) AND TSI<0;
trVal:=ValueWhen(1,tr,Ref(TSI,-1));
Osold:=Cum(trVal*tr)/Cum(tr);
{ Plot in own window }
Obought;avg;Osold;TSI
{ Reference "True Strength Index" indicator }
TSI:=Fml("True Strength Index");
oBought:=FmlVar("True Strength Index","OBOUGHT");
oSold:=FmlVar("True Strength Index","OSOLD");
avg:=FmlVar("True Strength Index","AVG");
{ TSI signals }
entry:=Cross(TSI,oSold);
exit:=Ref(TSI>oBought,-1) AND TSI<Ref(TSI,-1)
OR Cross(avg,TSI)
OR Cross(oSold,TSI);
{ Clean signals }
init:=Cum(IsDefined(entry+exit))=1;
bin:=ValueWhen(1,entry-exit<>0 OR init,entry);
long:=bin*(Alert(bin=0,2) OR init);
short:=(bin=0)*(Alert(bin,2) OR init);
signals:=long-short;
{ Plot in own window }
signals
[/code:1:4fd324329a]
Can you please assist again? Many thanks,
Reg Sinha
|