Click here to Login





                                                   Ranking System Optimization

  1

0
Dave W.
2013-12-20 00:26:02


Hi. Based on an article you wrote (3 ways to rank stocks in a trading system - Simulator and Potfolio), I decided to move the code from a ranking system object into my trading system simulator code to help me optimize it. I'm having trouble getting the simulator code results to match my former simulator + ranking system object results. For example, I get different # of trades, payoff ratio, annual return, etc.

Here's the relevant portion of my code. There are 5 additional buy rules not shown.

ShortRankFunction = sma( Close / GetSeries("SPY",close) , 5 );
Rule6 = comp( ShortRankFunction , "rank", 1, ShortRankFunction >= 35);

In the version with the ranking system object, I use the code shown in the ShortRankFunction variable above, and check the box to limit results to those with a score >= 35. I thought I was doing the same thing with the comp function, but I must be doing something wrong. In the article, you also mentioned adding another condition to the comp function related to the # of simultaneous positions to hold. I tried that also, but it seemed to remove all of my trades in the syntax given in the article.

Thanks for your help.
Dave



QuantShare
2013-12-20 13:09:29

  0

Hi Dave,

The formula is wrong, here is the correct one:

ShortRankFunction = sma( Close / GetSeries("SPY",close) , 5 );
Rule6 = comp(ShortRankFunction , "rank") <= 35; // The first stock has a score of 1

Regarding the # of simultaneous positions to hold, you should specify that in the simulator settings.





Dave W.
2013-12-20 23:36:40

  0

Ok. Hmmm... I can't seem to make it work. I runs without an error, but I seem to get the same number of trades no matter how I set the condition. Is there any reason the ranking engine wouldn't be ranking the results with a number from 1 to 100?

Here's my relevant code - slight modifications from the message above:

SpySeries = GetSeries("SPY",close);
ShortRankLength = 10;
ShortRankFunction = ( rocr( Close, ShortRankLength ) / rocr(SpySeries, ShortRankLength ) ) * 100 ;

RankThreshold = 10;
Rule6 = comp(ShortRankFunction , "rank") >= RankThreshold ; // The first stock has a score of 1

Probably something simple I'm doing wrong?



QuantShare
2013-12-21 11:57:02

  0

Best Answer
You made a mistake while copying the formula. The first stock gets a score of 1, so you should put:

Rule6 = comp(ShortRankFunction , "rank") <= RankThreshold ;

Instead of

Rule6 = comp(ShortRankFunction , "rank") >= RankThreshold ;


You can also use "percentile" instead of "rank" to get a result between 0 and 100 (100 corresponds to a rank = 1)




Dave W.
2013-12-23 22:07:52

  0

OK. I was able to almost match the results I got with the ranking system engine by using the percentile function instead of rank.

Thanks for your help.



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Super Stock Screener Ranking System
Trading System with Sharpe-Based Ranking
Intraday Trading System with Daily Ranking
RSI(3) Ranking System
Sharpe Ratio Ranking System to Lower Trading Strategies Volatilit...

How-to Lessons
How to optimize an indicator in your trading system
How to optimize the number of positions in a trading system
How to debug a trading system using the money management tool
How to set order type of a trading system programmatically
How to add a metric in the trading system simulation report

Related Forum Threads
Ranking System optimization - how to interpret?
Ranking System Help
Use of Comp with Full Ranking System
AI Optimization of Ranking
Filter out some symbols from ranking system

Blog Posts
Optimization of a trading system
Ranking System Engine
Ranking system calculation methods
Improve your trading system performance by ranking stocks
How to Backtest an Intraday Stock Trading System with EOD Ranking









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.