PureBytes Links
Trading Reference Links
|
Al,
Thanks for your reply. I've got to do more work on this.
I think your understanding of position score is right and
"highpositivescore best long candidates, lownegativescore best short
candidates." is correct in that a highpositive score(eg. rankings
>90) means price is closer to the lower BB which could be good for a
long position. lownegativescore(eg. rankings less than
10) means price is near the high BB .
The way I used ranking was only good for long positions. I need to work out
how to make it work for shorts also.
To get a display of position score rankings I think you could do something
with addcolumn command.
Bye for now,
Greg
----- Original Message -----
<BLOCKQUOTE
>
<DIV
>From:
Al
Venosa
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Thursday, December 18, 2003 10:02
AM
Subject: Re: [amibroker] StoRSI + 144MA +
BB rank
Greg, thanks for the code. I am embarrassed to even ask this question,
but at the risk of being called a dummy, I'm going to ask it anyway (maybe TJ
won't see it!). I still don't fully understand the PositionScore function
despite reading and re-reading the help file. It ranks stocks on the basis of
highest ABSOLUTE score. Yet, in your remarked statement after the Rank
line in your code, you state "highpositivescore best long candidates,
lownegativescore best short candidates." So, if it converts all Ranks into
absolute scores, how does it distinguish long candidates from short
candidates, since absolute scores are all positive? How do you get a printout
of the PositionScore stock ticker rankings? TIA.
Al Venosa
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Greg
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">AmiBroker@xxxxxxxxxxx
Sent: Thursday, December 18, 2003 8:13
AM
Subject: [amibroker] StoRSI + 144MA +
BB rank
Hi,
I was trying to workout a system in Amibroker that would use
StoRSI and 144 Ma for trading rules.
I wasn't having great results until I added a ranking method
presented by Gary Serkoshian in his slideshow presentation. It used
BollingerBands to score and rank the trades.
The following Amibroker Code is what I came up with.
Try it and tell me what you think about the system if you care to
comment and get the time. This is intended for trading a portfolio of two or
more stocks and won't improve the score of only one stock.
// Stochastic - RSI , recommended by Steve
Karnish //
// With portfolio mode //
/*****
** REGULAR PORTFOLIO mode
** This sample optimization
** finds what is optimum number of positions open simultaneously
**
****/
SetOption(<FONT color=#ff00ff
size=1>"InitialEquity", <FONT color=#ff00ff
size=1>10000 );
SetTradeDelays(<FONT color=#ff00ff
size=1>1,1<FONT
size=1>,1,<FONT
color=#ff00ff size=1>1);
RoundLotSize = 1<FONT
size=1>;
posqty = Optimize<FONT
size=1>("PosQty",
1, <FONT
color=#ff00ff size=1>1, <FONT color=#ff00ff
size=1>20, <FONT color=#ff00ff
size=1>1 );
SetOption(<FONT color=#ff00ff
size=1>"MaxOpenPositions", posqty);<FONT
color=#008000 size=1>
// desired position size is 100% portfolio equity
// divided by PosQty positions
PositionSize = -100<FONT
size=1>/posqty;
// The StoRSI system ......
//
StoRSI = EMA<FONT
size=1>((scRSI<FONT
size=1>(C,8) -
LLV<FONT
size=1>(scRSI<FONT
size=1>(C,8<FONT
size=1>),8))/
(HHV<FONT
size=1>(scRSI<FONT
size=1>(C,8<FONT
size=1>),8) -
LLV<FONT
size=1>(scRSI<FONT
size=1>(C,8<FONT
size=1>),8<FONT
size=1>)),3<FONT
size=1>)*100;
BL=11;
SL=89<FONT
size=1>;
//Trend qualifier .....
x=MA<FONT
size=1>(C,144<FONT
size=1>);
MAlong=x>Ref<FONT
size=1>(x,-1);
MAshort=x<Ref<FONT
size=1>(x,-1<FONT
size=1>);
//
Buy = Cross<FONT
size=1>(11,StoRSI)
AND MAlong;
Sell= Cross<FONT
size=1>(StoRSI,89<FONT
size=1>);
Short = Cross<FONT
size=1>(89,StoRSI)
AND MAshort;// AND
MAshort=True;
Cover = Cross<FONT
size=1>(11<FONT
size=1>,StoRSI);
//Plot(Equity(),"Equity",1,1);<FONT
color=#008000 size=1>
// now additional score
// that is used to rank equities
// when there are more ENTRY signals than available
// positions/cash<FONT face="Courier New" color=#008000
size=1>
//<FONT
face="Times New Roman">PositionScore = 100-RSI(); // prefer stocks that have
low RSI;
//
SetOption(<FONT color=#ff00ff
size=1>"WorstRankHeld",<FONT color=#ff00ff
size=1>10);
numerator=(C-<FONT color=#0000ff
size=1>BBandBot(C,<FONT color=#ff00ff
size=1>21,<FONT color=#ff00ff
size=1>2)) ;
denominator= <FONT color=#0000ff
size=1>BBandTop(C,<FONT color=#ff00ff
size=1>21,<FONT color=#ff00ff
size=1>2)-<FONT color=#0000ff
size=1>BBandBot(C,<FONT color=#ff00ff
size=1>21,<FONT color=#ff00ff
size=1>2) ;
Rank= 100<FONT
size=1>-(100<FONT
size=1>*((numerator / denominator))) ;<FONT color=#008000
size=1>//HighpositiveScore best Long Candidates,<FONT
face="Courier New" color=#008000 size=1>//<FONT color=#008000
size=1>Lownegativescore , best Shorts
//
PositionScore=rank;
<FONT
size=5> <FONT
color=#000000>*****
I'd be interested to know how this ranking method
compares with the Relative Strength ones we talked about
recently.
SetOption(<FONT color=#ff00ff
size=1>"WorstRankHeld",<FONT color=#ff00ff
size=1>10);
numerator=(C-<FONT color=#0000ff
size=1>BBandBot(C,<FONT color=#ff00ff
size=1>21,<FONT color=#ff00ff
size=1>2)) ;
denominator= <FONT color=#0000ff
size=1>BBandTop(C,<FONT color=#ff00ff
size=1>21,<FONT color=#ff00ff
size=1>2)-<FONT color=#0000ff
size=1>BBandBot(C,<FONT color=#ff00ff
size=1>21,<FONT color=#ff00ff
size=1>2) ;
Rank= 100<FONT
size=1>-(100<FONT
size=1>*((numerator / denominator))) ;<FONT color=#008000
size=1>//HighpositiveScore best Long Candidates,<FONT
face="Courier New" color=#008000 size=1>//<FONT color=#008000
size=1>Lownegativescore , best Shorts
//
PositionScore=rank ;
<FONT
color=#0000ff> <FONT
color=#000000>*****
Bye for now,
GregSend BUG
REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:<A
href="">http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
<BLOCKQUOTE
><FONT
face="Courier New">---Outgoing mail is certified Virus
Free.Checked by AVG anti-virus system (<A
href="">http://www.grisoft.com).Version:
6.0.552 / Virus Database: 344 - Release Date:
12/15/2003Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:<A
href="">http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
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 the Yahoo! Terms of Service.
|