In the backtesting world, things could be so simple; you define your buy and sell rules and the system generates signals and long positions on bars where the buy rule passes and exits those positions when the sell rule passes. Traders often need more complexity to improve their trading system backtesting results, and thus will tweak the order type, switching from a simple buy at tomorrow open using market order to buy at a limit price, or add stop rules like a trailing stop using the ATR as exit. There is also what is called 'Ranking', it can be added to a trading system to further improve its performance. 'Ranking' is used for example when you are backtesting a basket of equities. The simple buy and sell rule leaves the simulator with decisions that are generally made arbitrarily if no ranking system is defined in your trading strategy. Here is a simple trading system example: Buy when the 20-bars simple moving average crosses above the 100-bars simple moving average and sell when the 20-bars simple moving average crosses below the 100-bars simple moving average. Let’s say that on 12 august 2008, the simulation engine generates 10 signals and that our trading system has room for 4 more positions. The arbitrary decision we talked about later comes into play in the current scenario. What stocks will the simulator buy among the list of ten signals? If you don't define or tell the simulator how to act, the stocks that will be bought will be chosen generally by alphabetical order, which isn't really the best way to proceed. Here, there is a possibility to improve our trading system performance by creating a ranking system that will tell the simulator what stocks to pick when it faces such scenario, which often occurs when backtesting several equities. The ranking system will attribute a value or score to each symbol, and then the simulator will rank the symbols based on this value. The answer to the question regarding which signals the simulator will choose among the 10 available can now be solved. The simulator will choose the ones that have the higher score. We can for example add to the simple trading system discussed above a one rule ranking system: rsi(14). For each date, the engine will now generate signals, rank those signals based on the 'rsi(14)' formula, and finally select the top ranked signals. Those are the signals that will be transformed into trading orders. The trading system isn't limited to one ranking system; in fact two RS can be added: one for long positions and one for short positions. If you choose 'rsi(14)' as a rule for your ranking system (The RS is not limited to one rule, it can be composed of multiple rules and nodes with a factor and weight for each rule and node), you can add a short ranking system with the opposite formula (1 / rsi(14)). The higher the relative strength index the lower will be the signal rank.
|