Wednesday, October 21, 2009

Designing and Developing a Simple Trading System – Part 1

                                                 
Before I start, I would like to wish lp happy birthday!  You are as sweet as ever.

First, a quick recap.  You’ll need a historical data separated into two different periods (in-sample, out-sample) preferably each is more than 4-5 years of data consist of date, open, high low, close, volume and open interest (if possible).  I would like to side track a bit first by showing you what your eventual basic system will look like on FKLI data downloaded from Bursa Malaysia from 2004-2009 then I would follow on with the developing process using S&P 500 index futures.  The main reason is to show you different ways of using quantitative methods to design your trading strategies.

For our first simple system, assuming that we don’t like to have big losses but don’t mind a bit more whipsaws (remember it is always a balance, or trade-off), I’ve simply selected SMA (5) and SMA (10). The rules again:

1. Go Long 1 contract on next day market open when the daily closed SMA (5) crosses above daily closed SMA (10); if got Short position, Long 2 contracts (close Short contract and open new Long contract).

2. Go Short 1 contract on next day market open when daily closed SMA (5) crosses below daily closed SMA (10); if got Long position, Short 2 contracts (close Long contract and open new Short contract).

The eventual screen shot of this system would look like this (forget about margins, commissions etc. first):





Let’s scroll down and look at the profit and loss (P/L) of this very basic system:





You can see that the strategy is profitable on FKLI from 2004-2009. It made 705.5 points so far or equivalent of MYR 35,275.00 and even the open position is profitable.  Remember that the signal is generated at the end of the day and the entry price is the next day's openning price.

Please bear in mind that this has not taken rolls, slippage and commissions into consideration yet! We’ll come to that part in the later stage of development. We’ll use this strategy and go through the building and testing on the S&P 500 index futures on the next posting.
                         
Disclaimer: Taken from CFTC RULE 4.41 – HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER OR OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.


AND

WHATEVER YOU READ HERE SHOULD BE USED AS LEARNING AIDS ONLY AND SHOULD NOT BE CONSTRUED AS INVESTMENT ADVICE. IF YOU DECIDE TO INVEST REAL MONEY, ALL TRADING DECISIONS ARE YOUR OWN RESPONSIBILITY.
                                             

5 comments:

  1. for the buy and sell signal, we can only do it manually, right ? or there is a short cut ?

    ReplyDelete
  2. Yes, we'll have to program the buy and sell mannually, however, there is a simple way that the signal will automatically be shown when the new data is being added. I will come to that later.

    ReplyDelete
  3. Hi Han, part 3 and 4 seem to be missing from your blog. Could you kindly share them? Thanks

    ReplyDelete