PureBytes Links
Trading Reference Links
|
John / All
This is code I have concocted which seems to work well for me.
This is taken from my understanding of a Metastock code which I have had posted to me in a pdf:
this coincides with one posted elsewhere to this excellent group.
ROC(MOV((C/P),13,S),1,%)
I run this on all stocks or a select watchlist and then want to Filter this out as indicated in the code
/* rel strength search.
Run in AA Explorer set to Weekly. can change the "timeperiod" via Parameters.
Do RSC search as per the Metastock code. Start by defining the base index.
Then code for the relative strength of all stocks against this.
Then take a Moving average of this according to chosen time period.
Then do a ROC of this MA, according to your chosen time period.
Make sure that the Settings is to weekly and the n last quotations is 1. */
BaseIndex = "XAO";
P1 =Param("MA time period",13, 5, 20, 1);
P2 = Param("ROC period", 5, 1, 100, 1);
RS = RelStrength(BaseIndex);
MA_RS = MA(RS,P1);
RC = ROC(MA_RS,P2);
AddColumn(C, "C",1.3);
AddColumn(RS,"RS", 1.2);
AddColumn(MA_RS,"MA_RS",1.2);
AddColumn(ROC(MA_RS,5),"RSC",1.2);
/* I then want to filter this so that only those stocks whose Close > EMA(C,30)for five succesive weeks, AND whose Relstrength is above its Moving Average for 5 succesive weeks. Is there a quicker code for this part than what I have come up with? */
Filter = RS > Ref(MA_RS,-1) AND RS > Ref(MA_RS, -2) AND RS > Ref(MA_RS,-3) AND RS > Ref(MA_RS,-4) AND RS > Ref(MA_RS,-5)
AND C > EMA(C,30) AND Ref(C,-1) > EMA(C,30) AND Ref(C,-2) > EMA(C,30) AND Ref(C,-3) > EMA(C,30) AND Ref(C, -4)> EMA(C,30) AND Ref(C,-5) > EMA(C,30);
As you can see, I need help in rounding off the rough filter code I have created.
Is there a shorter way to code this?
Once again, TIA.
Chrisb
john gibb <jgibb1@xxxxxxxxxxxxx> wrote:Hi Kris,
If you look up RelStrength in the CHM
archives(http://www.amibroker.com/listarchive.html), I think you will find
your answer; one excerpt, from Tomasz:
1. Yes you can, but please remember about two things:
a) RelStrength() function needs an index ticker to compare to, for example
"XAO" (ASE all ordinaries index)
b) RelStrength() values are not normalized, so they are different for each
stock. This means that you can only get resonable results if you check for
rising/falling RelStrength or if you detect a new high or new low. Absolute
levels (such as 1) do not work.
2. Use graph1 = RelStrength( "XAO" ); to generate relative strength of
currently selected stock compared to the index.
3. Comparative Relative Strength is calculated by simply DIVIDING the
closing price of currently selected stock by the closing price of BASE stock
(usually an index):
RELSTRENGTH = CLOSE / CLOSE_OF_BASE_STOCK;
HTH,
-john
----- Original Message -----
From: "kris45mar"
To:
Sent: Saturday, September 04, 2004 9:35 AM
Subject: [amibroker] Relative Strength Comparitive and ROC (newbie)
Hi All
Help me out here guys.
I am trying real hard to understand what we are doing here.
I want to create searches based on Relative Strength comparison, to look for
strong sectors and then strong stocks in those sectors.
There are a number of codes out there in the forum but I am trying to get a
grip on exactly what is that the inbuilt Relstrength function does.
I want to know the Relative Strength comparison of a stock eg BHP versus an
index eg XAO, over a time period of 250 days.
Rate of change of BHP :
In English : the percentage change of the price of BHP from a time 250
days ago.
Mathematically = 100 * (today’s close - close of 250 days ago)/ close
of 250 days ago.
In Amibroker: ROC(BHP) = 100 * ((C – Ref(C, -250)) / Ref(C, -250));
Rate of change of XAO :
In English: the percentage change of the value of XAO from a time 250
days ago.
Mathematically = 100 * (today’s value – value of 250 days ago) / value
of 250 days ago.
In Amibroker : ROC(XAO) =
Now that I have the Rate of Change of each, is the Relative Strength
Comparison the difference between these two:
Relstrength = ROC(BHP) – ROC (XAO)
or the one divided by the other:
Relstrength = ROC(BHP) / ROC(XAO) ?
I am asking this because I have found this formula on the internet to use in
the Automatic Analyser as an Exploration:
//relative strength comparison run against XAO or relevant sector.
rsc = ROC(EMA(RelStrength("XAO"), 150), 25);
Filter = rsc > 0;
AddColumn(rsc, "RSC");
In english I think this formula says the 25 period rate of change of the 150
period exponential moving average of the relative strength comparison. Is
this correct or there some redundancy in this formula?
To understand this I need to know exactly what it is that Amibroker’s
Relstrength function is calculating: any help in plain "Newbie english"
would really be greatly appreciated.
regards
chrisb
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
[Non-text portions of this message have been removed]
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
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/
|