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

[amibroker] Multiple numeric variables



PureBytes Links

Trading Reference Links

Hello all,

I just wanted to share a simple code for determining trend I use for 
my mutual fund trading. Basically, if the long-term Trend Index is 
above 60, I consider this an uptrend, below 40 is a downtrend. One of 
the filters I use to buy funds is that the short-term Trend Index 
must exceed the long-term Index. I know that this Index isn't 
elegent, but it works very well for me.

//long-term PosROR count; ROR =rate-of-return//
period1 = Param("long-term",30,30,250,5);
ROR = ROC(Close,1);
PosROR = IIf(ROR>0,1,0);
PosRORratio = Sum(PosROR,period1)/period1;

//short-term PosROR count//
stPosROR = IIf(ROR>0,1,0);
stPosRORratio= Sum(stPosROR,13)/13;

//Index Calculation//
y1 = PosRORratio*100;
y2 = stPosRORratio*100;
Mov1 =EMA(y1,3);
Mov2 =EMA(y2,3);
Plot(Mov1,"long-term trend index",colorBlue); 
Plot(Mov2,"short-term trend index",colorRed);

Title = "Trend Index"
+ "  "
+ EncodeColor(colorBlue)+"long-term {" + WriteVal(period1,1.0) + " 
bars} = " + WriteVal(Mov1,1.0)
+ "   "
+ EncodeColor(colorRed)+ "short-term {13 bars} = " + WriteVal
(Mov2,1.0);

Dave Ankrapp
Lansing, MI




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
     amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/