//Start System Code
SetOption( "InitialEquity", 10000);
PositionSize = -100;
Buy = Cross(EMA(C,2),EMA(C,5));
Sell = Cross(EMA(C,5),EMA(C,2));
BuyPrice = O;
ClosePrice = O;
Unfortunately, the April Fools trading system is an unrealistic trading strategy.
The trading results and equity curves are real and were produced in Amibroker. However, the system code was designed in such a way that the results cannot be relied upon.
There are at least five major flaws with this system.
First of all, the trading system has been curve-fit to the existing data. The parameters for the moving average crossover were optimised to find the values that lead to the strongest performance in the test period. If we were to use these parameters going forward, there is a strong chance that they would not perform as well.
2. Future leak
Second, this system actually looks into the future. On line five (above) we have instructed Amibroker to buy a stock when the 2-day EMA crosses over the 5-day EMA. However, this EMA (exponential moving average) is calculated using the close price and Amibroker is actually buying the stock using the open price (line seven). In other words, we are buying the stock before the EMA crossover takes place, knowing that it will happen later on. This is clearly not possible.
3. Zero commissions
Thirdly, this system uses no commissions or slippage. In real life, it costs money every time you make a trade . You are also not guaranteed to get filled at the price you want, especially for large orders. Having no commission or slippage is not realistic and can make a big difference to simulation results, even more so when trading on short-term timeframes.
Fourth, this system suffers from survivorship-bias. The system buys stocks from the S&P 500 universe, however, in this instance we have not included historical constituents or delisted stocks. This means our results are a victim of survivorship-bias.
In real life, businesses go bankrupt, they get taken off the exchange, some merge with other companies. These changes are not always reflected properly in historical databases. Thus, it’s always important to use data that is survivorship-bias free. Such data can be obtained from Norgate Premium Data and easily accessed in the Alpha program.
Lastly, the system relies on unrealistic liquidity. When you buy a stock in real life, your position size and entry price will be dictated by how many shares there are available to purchase at the time, also referred to as volume. Normally, you would not want to purchase more than five or ten percent of the total volume as any more would than that would suck up the order book and move the share price not in your favour. This system has a limit of 50%, meaning, it’s able to buy up half the day’s volume without any movement to the buy price. This is unrealistic.
Running the System Again
Now we know what are the major flaws with this trading system we can fix them up, move the dates forward and run the system again using unbiased out-of-sample data between 2012 and 2016.
Following are the results:
Incredibly, the trading system actually made money in the out-of-sample test even though the rules were data mined. However, as expected it achieved nowhere near the same performance level.
The truth is that you will never find a trading system that makes 170% a year. Even though thousands of traders every year are duped into buying one.
So, sorry to build your hopes up with the dream of a 170% per year trading system. But I hope you have at least learnt some things to look out for when building or analysing a trading system.
I know you didn’t fool for it anyway 😉