Wednesday, December 29, 2010

Programming Chart Pattern in Excel - Part 3

                             
Here's the updated screen shot that anonymous requested.  The first one shows the short in 2008 and the second one shows the long in around mid this year. 

Please also take note that this is consider cherry pick and I am in no way promoting these trading rules.  Run the back-test and optimize the parameters on your own before even consider trading it.





Cheers & Happy trading!
                                     

Programming Chart Pattern in Excel - Part 2

                                                  
As expected, Excel realised the "strangeness" in the output on my previous post.  I realised the ambiguity in the rules given when I did the programming to let beginners know that when writing your algo, you can't assume that the programmer can use common sense to fill in the blanks left by the rules, it has to be clear and precise otherwise it will be GIGO (garbage in, garbage out).

To make some sense out of the rules given, here's my interpretation of the blanks being left out (in addition to the updates given by Excel that I've missed as it went into SPAM's tab) and the output from the updated version.

1.  The z bar lower close compare to z-1 happen while market is in uptrend (y continuous higher highs AND x continuous lower lows).
2.  Market is considered to be in uptrend until they are in down trend (b continuous lower highs AND a continuous  lower lows) and vice versa.
3.  Buy-stop order instead of buy (that's is just my mistake on typing the order type, I assume that you know it is a buy-stop order when the buy price is much higher, I am sorry, thanks for the correction, Excel)
4.  You could define different parameters for up trend and down trend, although you have to be careful on the long or short bias in your system when you use different values, usually it is consider bad if one side is easier to be fulfilled than the other.  You would have trouble when there is a regime or paradigm shift.  I hope you understand what I mean :).

Here's the updated screen (done in <10 min):


Oh yes, one more thing Excel, I am sorry that I am lazy to do the charts since the numbers already speaks to me :) and personally I think this could be further improved to be a good trend-following system. 

Cheers & Happy Trading!
                      

Tuesday, December 28, 2010

Programming Chart Pattern in Excel - Part 1

                                             
In response to Excel's comment on my previous blog, here's the screen capture (graphical requested by Excel) of the rules (programmed in MS Excel using only in-cell formulas) given by Excel on the comment section on my previous post.

This is the ouput from  < 30 minutes of programming.  I am sure it can be further improved.


All the parameters in red color can be changed and calculations will be updated automatically!

Just do the reverse for Sell and plug-in your modules for back-testing and you are set to begin optimizations(since you already have the Buy/Long, Stop-loss and Profit target price)!

Cheers & Happy Trading !
                                   

Friday, July 23, 2010

Verifying Historical Volatility Calculation

              
This article was written for you, Bryan.

Since you brought up the question of whether volatility is an arbitrary value in your comment on my previous article, I've been curious to find out if I am still half as good as I was a few years back :) .  Since most of the files I did last time were lost, I spent many hours trying to find and finally managed to dig out an annualized 30 day historical volatility of KLCI from 2001-2006 that I've downloaded from Bloomberg (industry standard other than Reuters) last time.

The first thing I did was to plug-in the KLCI index value into the Excel that I've created to calculate the volatility of FCPO and put Bloomberg's data side by side to compare.  Then I tried to find the period that has been used by Bloomberg to calculate the annualized 30 day historical volatility. 

After a few trial and error, I managed to get the same exact value of KLCI's annualized 30 day historical volatility value with Bloomberg.  Bloomberg uses 260 days instead of 252 trading days in a year.

As usual, the screen capture is as below:




Cheers & Happy trading!
                                          

Tuesday, July 20, 2010

FCPO Volatility Measurement

         
Since I've heard a lot of people talking about how hard it is to trade our FCPO these days because of the high volatility, I've decided to do some facts checking of my own.  To have our own view in the ocean of opinions surrounding us every day that could influence and cloud our judgment is the first step towards becoming a good systems developer.

Since every subjective statement is relative, I've written a simple Excel spreadsheet to measure and compare FCPO's volatility since end of 2006 until first week of July 2010 and see if it is true that recent volatility is higher than average between this period.

Since most of the trend-following systems are using daily data, I've decided to use the daily closing price (unadjusted though) to measure the annualized monthly volatility.  I don't wish to go into the detail definition of volatility measurement as you can easily google and read them.  Okay, okay, I know you are lazy, here's a quick definition I copied from Wikipedia : Volatility refers to the standard deviation of the continuously compounded returns of a financial instrument within a specific time horizon.

As usual, a picture is worth more than a thousand words...

As usual, surprise!  FCPO's volatility recently is the lowest in about 4 years that I've measured!
              
If you believe that low volatility means that market tends to be in cycles more than trend, then naturally a trend-following system would be going through the usual drawdown, how bad the drawdown is just a function of balance between risk and reward that you choose. 

As usual, too aggressive and you'll have higher probability of reaching maximum drawdown that you are able to stomach, too conservative and the return may not justify trading in futures market.  Again as usual, there is no one size fit all solution because everyone is different!  That is why trading is always challenging and interesting!   Cheers & Happy trading!

                                    

Tuesday, June 15, 2010

Evaluating Trading Returns

                                         
Too often when beginners are evaluating and comparing systems' performances, the first and only thing that is on their mind is they want to see and compare which has the highest % of return only.  In my opinion, that could be quite dangerous. 

Remember that nothing is really free in this world, when you see a system that has a very high % of return, the next few things you should look at (other than at least total trades of more than 50 has been generated) is how much startup capital was used to get that % of return?  What is the Maximum (Open & Close) Drawdown as a % of the startup capital used?  What is the Standard Deviation of trades as a % of startup capital used?  Can you verify the performance yourself?

In short, the % of return is only meaningful when you look at the risk at the same time.  They are the different sides of a same coin!

To show you what I meant, I have two different performance summary for you to compare and choose.  If you love high % of return alone, you would probably choose the first one.  However, if you have lower risk appetite and don't mind a bit lower % of return, you would probably choose the second one, if you have to choose one.

The 1st one...
            
The 2nd one...


Actually both of them are quite similar, its just that the high % of return for the 1st one is due to much lower startup capital being used compared to the 2nd one.  If you can stomach drawdown of more than 90% or you always think that you are the lucky one and would always escape that drawdown when you start trading, then by all means go for the higher % of return one.  If you can stomach only maximum drawdown of about 30-40% , then you may want to consider the 2nd one, if you have to choose between the two.  Cheers & happy trading!


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.

                                                                 

Wednesday, May 12, 2010

My View On Systematic Trading

     
I received an email from "Blurrturtle" that asked "What are your rules for system trading?"

When I first got this email, I was thinking whether this is a trick question.  System's trading by definition is already trading with a set of rules.  So naturally I was wondering if "Blurrturtle" wanted the set of rules in my trading system or just basic guideline on systematic trading.  I believe he/she meant the second part.

Novice trader may be wondering, why are there so many rules to systematic trading?  First you have a set of rules that govern what, where, when and how you trade, then you have another set of rules to make sure that you follow the previous set of rules!  I'll try to explain why in my future postings.

Here's my simple set of rules for systematic traders:
1. Do proper back-testing and optimization.  Make sure you know your systems performance well then ask yourself if you are comfortable with the max drawdown (usually it will happend sooner and bigger than you think) and how long it takes to recover? If not, don't trade the system or find another one.
2. Make sure you have sufficient startup capital (identified via your back-testing) before start trading.
3. Have in place a method to tell you that you should stop trading the system when it is no longer working.
4. Just strictly follow your system (without fighting with yourself and the market) until 3 happens.  This is usually the hardest part.

I hope that answers the question posted by "Blurrturtle".  Cheers & Happy trading.