Hi Cone & Eugene,
I'd like to test a Relative Strength Rotation System from Michael Carr's book "SMARTER INVESTING IN ANY ECONOMY, The Definitive Guide to Relative Strength Investing " on Fidelity's sector funds.
He starts with the 12 times 26 week moving average of the rate of change. He ranks the results and buys the top 3. He doesn't sell until one drops below 6 on the list to avoid volatility and excessive trading. He then replaces the sale with a buy from the top 3 ranked funds.
To test his system we need 4 variables:
BuyRank = //Number of top ranked funds to own
SellRank = //Sell if below rank number
ShortMovNo = //Short term Moving Average of Rate of Change
LongMovNo = //Long term Moving Average of Rate of Change
I tried to create them in lines 17 thru 20 but my code is returning an error "The type or namespace StrateryParameter could not be found.
Would you please tell me what I'm doing wrong!
Also the list for selling needs to be 6 (SellRank) and the list for buying needs to shrink to 3 (BuyRank). In lines 192 thru 196 I've tried to reduce the list a second time to 3. I hope it will work, but it may just be a way to entertain you with my neophyte knowledge.
Many thanks for your help!
Tobey
CODE:
Please log in to see this code.
Size:
Color:
Tobey,
1. First things first, you will not get what you want by doing it like this...
CODE:
Please log in to see this code.
...with the Carr2Mov series being created only once - way before you create the list of highest RS symbols.
Consequently, it is static: it's executed just once on the clicked symbol and will produce identic (incorrect) results. To correct this, move the building of that DataSeries inside the DataSetSymbols loop after SetContext.
2. To implement the multiple list (i.e. buys top 3 and not sell until one drops from top 6), please follow this design pattern:
ROC Symbol Rotation - Modification of the Strategy, post #6
Rotation EnhancementQUOTE:
I tried to create them in lines 17 thru 20 but my code is returning an error "The type or namespace StrateryParameter could not be found.
There's a typo: Strate
ryParameter.
Size:
Color:
Hi Eugene,
Thanks! Your post #6 was a big help!
I've commented out the chart design. I've use the default numbers to start with. I'll switch them to sliders when everything is working
The code below compiles OK but when it runs on a list it gives an error
Runtime error; Non-negative number required
at WealthLab.Strategies.RS_Rotation.Execute()
at System Collection.Generic.Liist'1.RemoveRange(int32index. Int32 count)
I checked the default numbers and they look OK. Ad least it's not a typo. If you would tell me what needs to be done to fix this error I would appreciate it.
Many Thanks
Tobey
CODE:
Please log in to see this code.
Size:
Color:
Replace this code:
CODE:
Please log in to see this code.
With the
original example code:
CODE:
Please log in to see this code.
+
CODE:
Please log in to see this code.
Hope this helps.
Size:
Color:
Hi Eugene,
Thanks again. That got the system to run. It is showing two buy Alerts. But it is not showing open positions and a trading history. There most be something in the code that I am missing. Hope it isn't a typo.
I activated the Indicator Pane by creating a second set of Data Series that add g_ (for graph) to the beginning of the same series in the rotation code. The graph plots OK.
I also added the code to print out the list. But it's not working. I'm not sure if it's in the right place or if it is a code problem.
Thanks again for all your help.
Tobey
CODE:
Please log in to see this code.
Size:
Color:
Check line 171 of your code. You omitted one line when copying/pasting and this made all the difference:
CODE:
Please log in to see this code.
Without it I did show open positions and a trading history (make sure the data loading range was adequate), but of course produced incorrect results.
Size:
Color:
Hi Eugene,
Thanks! I'll try to be a better copy cat.
With that fix the strategy works with ETFs and Stocks. But it is not working against Fidelity Sector Funds. I made a second copy to modify for Funds. I Changed the BuyAtMarket to BuyAtClose but that didn't do it. What do I need to do to get it to work with mutual funds?
Secondly, I'd like to print out the ticker list with the indicator number so I can see what's happening during testing. I thought this should be done right after the list is created while it is still a complete list. Is that right? And is there a link to some similar code for a Copy Cat to adapt?
Thanks Again for all your help.
Tobey
Size:
Color:
QUOTE:
But it is not working against Fidelity Sector Funds.
What exactly does not work?
Food for thought:
How to Report Bugs Effectively >
"It doesn't work".
Size:
Color:
Hi Eugene,
Sorry for the lack of details.
On my list of Fidelity Sector Funds, It is showing one buy Alert. But it is not showing open positions and a trading history.
Both positions and a trading history show up if I run it against a list of ETFs or Stock tickers.
Thanks,
Tobey
Size:
Color:
Tobey,
On my list of Fidelity funds (see description of "Fidelity Select Sector Fund Rotation system"), I have dozens and hundreds of trades and alerts with any position sizing (e.g. 10-100% equity) and reasonable data ranges (like 500 bars EOD Yahoo data). How exactly you're running this system to produce these results, is still unknown to me due to lack of detail.
Size:
Color:
Hi Eugene,
This may not be a code issue. I compared the code in your "Fidelity Select Sector Fund Rotation System [Rev.A]" The buy & sell code match with the exception of your hold for 30 days rule. Both use
CODE:
Please log in to see this code.
CODE:
Please log in to see this code.
So I ran "Fidelity Select Sector Fund Rotation System [Rev.A]" against my list of Fidelity Sectors and I got no trades. I ran it against a list of ETFs and got trades. This is the same problem I am getting with the Carr Code you helped me create.
Just to make sure my ticker list was good I deleted it and created a new one using the one on the "Fidelity Select Sector Fund Rotation System [Rev.A]" web page. But I still got the same results, no trades.
I'm using:
WealthLabPro 6.5.20 64-bit Edition
Windows 7
Intel 2 Duo CPU T9900 @ 3.06GHz
16 GB ram
Below is my full Code.
Thanks Again for all your help!!
Tobey
CODE:
Please log in to see this code.
Size:
Color:
Hi Eugene,
OK I found the problem in the
Preferences > Backtest Settings
Reduce Quantity based on Volume
It was set to 10% of the Volume Bar.
(Maybe good for day-trading but not Mutual Funds,
Uncheck it and every thing works.
Thanks again for all the help!!
Tobey
Size:
Color:
Hi Eugene,
For back testing, I would like to be able to print out a list Ticker symbols with the ranking number from a rotation strategy run. This would let see the list that strategy is selecting from. So in the above code I'd like to print out the complete BuyList or SellList before it is cut to the actual short buy or sell lists of a few symbols.
I've looked a the reference I can find on printing lists and not gotten very far. Can you tell me where there is a rotation strategy that includes printing a list that I could reference. Or give me any other ideas on how to code in printing a list in the strategy?
Thanks for the help!
Tobey
Size:
Color:
Try this:
CODE:
Please log in to see this code.
Size:
Color:
Hi Eugene,
Thanks! That works! I was able to copy the last row of the Debug and Error report into a spreadsheet. Then I could look up the Carr2Mov number on the chart.
Is there a way to collect the Carr2Mov number in the Debug and Error report? That would save a lot of look up time. Maybe it would even cut out the copying it Excel step.
Thanks Again
Tobey
Size:
Color:
QUOTE:
Is there a way to collect the Carr2Mov number in the Debug and Error report?
Yes.
Carr2Mov is a member of the
RS_Holder type. See how my example in post #14 accesses symbol name stored in an instance of
RS_Holder? You do the same to include
Carr2Mov in the report.
Size:
Color:
i have placed the following code from post #11, i used the symbol nvda, and than clicked on print and debug under tools but there is no report, i wanted the buy and sell list in print and debug but no list is seen.
Size:
Color:
Not enough details.
1. First and foremost, have you compiled the strategy before "using the symbol NVDA"?
2. What DataSet did you use: bar scale, how many symbols does it contain, data loading settings?
3. Have the strategy finished processing or is it still running?
Size:
Color:
There are several rotation system scripts in the sample stratgies. When I am testing the different scripts, one problem is always there: the same trade is executed on one symbol more than once. Do I have to adjust the position size with "PosSizer"?
What is your recommend "rotation code" to start with and which ihas been tested for example with ETFs?
Size:
Color:
Size:
Color: