Convert Trend Intensity Index metastock formula into Afl

#1
Dear Seniors Any body please convert this metastock formula into Amibroker Afl


Name: Trend Intensity Index
Formula:
x:=Input("number of periods", 5,100,30);
ma:=Mov(C,2*x,S);
sdp:=Sum(If(C-ma>0, C-ma,0),x);
sdm:=Sum(If(ma-C>0, ma-C,0),x);
(sdp/(sdp + sdm)) * 100
Name: Trend Intensity Index - trade position
Formula:
x:=Input("number of periods", 5,100,30);
ma:=Mov(C,2*x,S);
sdp:=Sum(If(C-ma>0, C-ma,0),x);
sdm:=Sum(If(ma-C>0, ma-C,0),x);
tii:= (sdp/(sdp + sdm)) * 100;
If(tii>=80, 1, If(tii<=20,-1, 0))
 

Similar threads