[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Help with Trend Continuation Factor from S&C Bonus Issue



PureBytes Links

Trading Reference Links

hi,
 
I don't think you need loops for this, see below,
 
rgds, Ed
 
 
per = 35;

tt =
Sum(IIf(C > Ref(C,-1),C - Ref(C,-1),0
),per);
uu =
Sum(IIf(C < Ref(C,-1),C - Ref(C,-1),0
),per);

Plot(tt,"Sum up days over 35 day period",colorWhite,1
);
Plot(uu,"Sum down days over 35 day period",colorGreen,1);
 
 
----- Original Message -----
From: Mike Mann
Sent: Thursday, March 03, 2005 11:13 AM
Subject: [amibroker] Help with Trend Continuation Factor from S&C Bonus Issue


I'd like to code the TCF presented in this issue and need to sum the
gains on positive days for the last 35 days, and the same for the
negative days out of the last 35 days.

I tried the following code for the positive days, but system
indicates I have created endless do loop......... can someone offer
a suggestion.  Thank you so much.....  Mike

for( i = 0; i < 35; i++)
{
      TP = IIf ( i=0, 0, IIf(Ref(C,-i)>Ref(C,-(i+1)), Ref(C,-i)-Ref
(C,-(i+1)),0));

}

Plot (TP,"TP",colorWhite,styleHistogram);







Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html





Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links