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.
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.
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:
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.