Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the restrict-user-access domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home1/portfol1/public_html/wp/wp-includes/functions.php on line 6114

Deprecated: Class Jetpack_Geo_Location is deprecated since version 14.3 with no alternative available. in /home1/portfol1/public_html/wp/wp-includes/functions.php on line 6114

Deprecated: preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated in /home1/portfol1/public_html/wp/wp-content/plugins/add-meta-tags/metadata/amt_basic.php on line 118
Trading System | Portfolio Yoga - Part 2

The Peter Brandt Interview

Couple of days ago, a friend of mine provided a link to the interview of a trader who despite his humongous returns has never been in the lime light as many others with even lower success have been. In fact, the interview starts off with the line “may be the greatest trader you’ve never heard of.” and damm if that is not true, especially in the Indian context where we are regularly exposed to few proprietary traders who have made it big not by investing but by trading.

The returns (Audited) he has generated is something that is really out of the world so as to say. He has in a sense converted a sum of Rs.100,000.00 (One Lakh) to a astounding Rs.240,34,45,879 (Two hundred & forty Crores and some change) in a span of 29 years.

Below is a chart of the time and years taken by the top fund managers

USFund Managers Returns over Time

 

Peter Brandt is in a league of his own. And the best thing about his return is not the amazingly long period he has been able to achieve but that he has achieved more or less without much of a noise.

Some of the really quotable quotes I liked in the Interview (and my thoughts)

And I felt so strongly, that “this is it…the time to bet the farm.”

A wonderful quote says and I quote “The greatest risk is the one not taken”. A famous quote by by Ed Seykota says – Know when to break the rules. While I myself do not think that breaking the rules is a worthwhile strategy for all, the fact remains that the greatest investors and traders realized the road to success lay in not being in the safe zone all the time.

As much as its important not to over leverage, when a once in a Century opportunity comes along, its also necessary to be nimble and take a risk that may not be what most prudent investors advise you to.

For me, one of the biggest things was realizing I was not going to be right 80% of the time, or even 50% of the time. I would be right about 35% of the time – but that was over an extended period of time

Being a trend follower, does it delight me to see him emphasize on the fact that to be a successful trader, the strike rate is not something that should lie in the high 80’s or 90’s.

And depending on how bold I am, how I feel about the market, I might risk up to 1.5% on the trade. There are times where I have risked 3%. But it’s rare that I do that.

I am amazed when I talk to novices who tell me they risk as much as 10% of their capital on a trade! Well I did that too. Back in the late seventies I did that, and I can tell you it doesn’t work! Risking 10% of capital on a trade is a well traveled road to ruin.

Risk Management is a area which is not given enough thought. While I do see people talk about stop losses a lot more these days, the fact remains that very few are disciplined enough to execute a stop when it hits. Our behavioral biases make sure that letting go of a losing trade is tougher than letting go of a winning trade (opposite the way it should be).

Question: Have your signals or trading decisions changed much over the years?

PETER BRANDT: For me my signaling hasn’t changed much, although I’m moving toward the point where I’m wanting longer term signals – almost to where I can throw my daily charts away and just deal with weekly charts.

Sometime back I remember reading (or hearing in a podcast) a similar question being asked to William A. Dunn, the founder of Dunn Capital who too has a very long run of great returns though his draw-downs are way deeper than what Brandt has ever got hit with.

Most traders love to change strategies / systems as soon as the one they are trading seems to get bogged down. But if the greatest traders have survived without tinkering much (and employing way more capital than most of us can even dream off), I wonder how much of this tinkering actually is destructive to our long term aims and goals.

And so, without much ado, here is the link for the Interview (Interview with a trading Legend).

Personally I would suggest you not to rush off in reading since there are quite a few things that provide a lot of learning’s and in a quick scan, its way easy to miss the meat of the interview itself.

If there is one thing, one learns from episodes such as this, its the fact that the top guys rarely make any noise while they go about doing their business as if time has stood still. They aren’t the first to jump about to tell everyone about how good a call they made in the daily circus that is run on the Idiot Box, most of them don’t have anything to sell (other than a book or two) and finally are humble.

 

Trend following & the Greek Referendum

One of the reasons I am a strong believer in trend following is that I have observed that in all cases where markets were supposed to be caught by surprise by an event that shook the markets, the trend was already down. I have in the past given presentations and talks using examples such as the Kobe earthquake, September 11 attacks, our Election results among others. Every time, the trend was already established in line with the future unfolding.

To that extent, this day’s opening gap down of 1.6% was definitely a surprise since markets seems to have had the least amount of any such anxiety going into Friday’s close. In fact, even the Greece markets seemed to have missed any clues as it closed in the Green on Friday.

The non believers though seem to have been having a field day

So, I decided to see, how often this is the case – the case of the short-term trend being up and markets opening down 1.6% or greater. For the short-term trend filter, I used a 15 day EMA.

Since 1999, we have had just 4 such instances with the last event being on 16th July 2013. And other than the 1999 event day, every other day, we actually closed above the open price though on no occasion did the markets close in positive territory (and that includes today obviously).

The table below showcases the performance of the markets for the next 5 days post such events

T

Based on historical evidence, t+1 which is tomorrow, seems to have an edge in terms of a positive close. But more interesting is that other than in 1999, the bullish trend of the past seems to have held on with this day being an aberration of some sort and not a deal breaker (given the low number of instances).

 

Trading with the Longer Trend

One of the often quoted things is that one should always trade with the higher trend. So, if the higher trend is bullish, it makes sense to avoid shorts and take only longs and vice versa. As much as the advise seems great theoretically, its only after testing can we really be sure whether such a strategy really makes economic sense.

The biggest draw-back so as to say when it comes to trend following is the streak of losses that one sees. This generally takes place when the markets are undecided on where next to go and oscillates between a high and low point.

With the current trend among traders being “Market Profile”, this area is also seen as  bracket area where both the bulls and bears are in control of their respective zones and defend the same. So, when markets go to the upper range, bears become pro-active as they short the market with the anticipation of a pull back to the lower zone where bulls are willing to take charge.

For a trend follower though, such back and fro movements are killers as they get repeatedly stopped out while the market in itself would have not moved anywhere. Or even worse, we get caught in counter trend trades, even as the larger trend in itself is relatively undisturbed.

For example, take a look at the chart below. Its of CNX Nifty (Spot) with Arrows being the Buy & Sell signals generated based on a simple 3 * 5 Moving Average Crossover

Nifty

Specifically concentrate on the marked area – the markets were well and truly bearish, yet, our buy signals got triggered a lot of times before the final Buy actually resulted in a good profitable move

What would happen you may wonder if I were to add another longer term Moving Average to figure out whether the trend is Up or Down and act based only upon that.

Since we are looking at the whole situation objectively, we will need to not just randomly pick up a Moving Average which shall tell us whether the trend is up or down but find that number by analyzing all possible options.

One way to do that would be simply optimize the parameter at hand. Of course, we shall then fall into fitting the curve, but since the idea is to see whether our logic is right or not, we will not worry about it for the moment.

So, on top of the 3 by 5 Moving average crossover, I tested for what variable would be the best fit (one for the Bullish trade and one for the bearish). After testing through nearly 35,000 options, the best among the lot seemed to suggest using 150 day MA for our bullish objectives and 200 day MA for our bearish objectives.

Before we go ahead and see the results based on this, lets first see the results of the standalone system.

The test was carried out on EOD CNX Nifty (Spot), No commissions were included and all trades were taken on the closing price of the same day. No compounding of Positions  was allowed.


3-5 BT-1

3-5 BT-2

As you can see, while the long trades are extremely profitable, even shorts end up in profit territory despite the fact that markets as a whole has moved up by around 6500 points in the interim.

Now, lets apply our filter of going long only if Signal has come with Close  > Moving Average of 150 periods and going short only if Close is < Moving Average of 200 days.

Because of the additional filter, this system will not be a Reversal system anymore (i.e., Long exit is also Short entry & Short exit is also the trigger for Long)

Results are as follows;


Filter - 1

Filter - 2

So, what are the key differences between them.

First is the fact that having a filter reduces Net Profits. While a simple Crossover provides us with 10,363 Nifty Points, the Filter reduces this to 8,181, a reduction of 21%.

The Number of trades is lower for the Filter compared to the plain vanilla approach. While the plain vanilla approach has 504 trades, the filter reduces this to 232, an incredible reduction if one were to say. This reduction also means that we are not always exposed to the markets as in case of plain vanilla.

While the plain vanilla crossover approach requires us to be in the trade all the time, in this case, that requirement is no more present. The filter version is in the market for 2117 days vs the normal which is in the market for 4333 – again a huge difference.

And finally, lets look at the most important factor – draw-down. System draw-down for the plain vanilla was 15.62% vs 8.63%.

All in all, having a filter will help in having a smoother returns but has the opportunity cost of missing trades (ones where the market trend is changing from Bull to Bear and vice versa).

Its all finally about give and take. If you are happy with a lower return (point wise), you can smoothen your equity curve. But if you are happy & are able to take in volatility, plain villa offers you a higher profit ratio.

200 Bar Average

For a very long time, the 200 day average is seen as a barrier between bull and bear markets. While many a analyst questions the reasoning behind using the 200 and not 199 or 201 (which anyway will make for not much of a difference), the key reason 200 came to be seen as a major average was that in an earlier era, markets were open more or less 200 days in a year.

The key question though is should one use a simple moving average (DMA) or a exponential moving average for calculation. The key difference here being that while a simple moving average provides equal weight to all the bars, a exponential moving average provides more weight for recent data and less for the older data.

Exponential is what I personally prefer because I believe that if market data has predictive information, one should have much more weight for yesterday’s data bar than the data bar that is 10 months old. Of course, other than DMA and EMA, we have many a way to slice and dice the data when in comes to moving averages. For the sake of brevity, let me list out a few of them.

DEMA -> Double Exponential Moving Average

TEMA -> Triple Exponential Moving Average

WMA -> Weighted Moving Average

While much of the Industry usage is limited to DMA or EMA, lets test out the viability of all the above variations of the Moving Average to see if thinking differently leads to a better output.

The test is as usual conducted on Nifty Futures (Rolling – No Adjustments) with no compounding of position sizes. All trades are taken at the closing price. A commission / slippage factor of 0.05% per trade is applied. While 0.05% may appear excessive in these days of discount brokerage, traders paid a brokerage which was much higher than even that just a few years back.

Nifty was tested from 12-06-2000 till 24-04-2015. We took only long trades (no Shorts). The key numbers to look out for in my opinion are

1. Profit generated (measured in Points)

2. Maximum Draw-down (measured in % from the highest peak to the lowest trough)

3.  Number of Trades

So, here are the results

DMA

While no average is able to beat the Buy & Hold in terms of point returns, DEMA comes way close and as a added benefit is also one which has the lowest draw-down.

While the DMA was broken just today, the DEMA was broken way back on 9th March. But on the negative side, this average was broken multiple times over the last few months.

All in all, if you want to use a moving average that is not too short and not too long, 200 is worth a look.

 

 

 

Trading System Performance – Skill or Luck

So, you have finally devised your trading system which seems to have produced good returns in the back-testing you have conducted and is ready for trading with real money. Pat yourself on the back since regardless of what happens next, you have taken a step towards being a better trader by using a rule based strategy than implementing a discretionary strategy where every rule has a exception and every failure is easily rationalized.

By accepting that we have our limitations which can prevent us from succeeding in markets, we are able to make our trading more process driven and one where mistakes aren’t rationalized but seen through the eyes of it being either a part of the system or the failure of the system. Either way, the results showcase how good or bad your system is (assuming you take every trade and do not try to over-ride your own system).

While a back-test is a good way to analyze as to whether the system has any merit or not, it is not the end of testing but actually the beginning. It is said that if you were to give typewriters to monkeys, its just a matter of time before one of them hits all the right keys and gets you a Shakespeare’s plays in order.

Or as the character Dr.Alfred Lanning in the film I, Robot says “Random segments of code, that have grouped together to form unexpected protocols”. If one keeps testing ideas, especially using optimization feature, one is bound to hit the right system. Its just a matter of time.

The question hence is, is the system performance due to Skill or pure Luck. A system that is based on some skill or market  inefficiency. A system that is based on luck is one where in the streak of profits is just purely driven by luck and its just a matter of time before the said system starts misbehaving.

So, how does one determine whether the profits that are shown in the back-test is due to it being inherently good or just a matter of luck.

There are a few ways to analyze that and I shall lay out a few of them out here. To start with, let me choose a system which will be used for the testing.

The system that I shall use for the test below is a EMA Crossover. To get the two parameters, I ran through a Walk Forward Optimization which finally gave me the 2 variables I was after.

Now that the main requirement is fulfilled, lets move onto what are the ways by which you can detect whether the performance of your system is more based on luck than skill.

The first thing to do is to test your system on other time frames / markets. No single system performs exceptionally well in all time frames / markets and hence if you are looking for a 100% score, you are bound to be disappointed. What we are looking instead is performance that is well within limits.

Lets take the EMA Cross system that we have now created. The testing was done on Daily time frame. Lets compare this to Hourly as well as Weekly and see how different the numbers will be. To keeps things simple and as well as have a standard format, we shall use Expectancy as the parameter to judge. Time frame of the Test is from 1st Jan 2010 to 1st Jan 2015.

Other test settings are

  • We trade on Close Value
  • No Commissions or slippage is included.
  • We do not compound our position size
  • We take both Long & Short trades (Always in the trade)

We shall first test the system on the Daily time frame. While the optimization was done on CNX Nifty (Spot), we shall see how the system fares on other Indices

Index Time Frame Expectancy
©Portfolio Yoga
Nifty-F1 Daily 25.84
Bank Nifty F1 Daily 212.42
CNX Auto Daily 87.64
CNX Commodites Daily 10.83
CNX Consumption Daily 16.04
CNX Energy Daily -28.55
CNX Finance Daily 95.2
CNX FMCG Daily 82.34
CNX Infra Daily 21.56
CNX IT Daily 22.04
CNX Media Daily 24.48
CNX Metal Daily 28.9
CNX MidCap Daily 255.5
CNX MNC Daily 52.34
CNX Pharma Daily 4.87
CNX PSE Daily 57.34
CNX PSU Bank Daily 98.52
CNX Realty Daily 5.45
CNX Service Daily 23.82
CNX Small Cap Daily 98.66

The system is profitable in most indices save for CNX Energy where it saw a loss. This is good since it indicates that the system is not curve fitted to Nifty.

We shall now move to testing the system on hourly data.

Index Time Frame Expectancy
©Portfolio Yoga
Nifty-F1 Hourly 7.07
Bank Nifty F1 Hourly 17.9
Reliance Hourly 0.87
State Bank of India Hourly 1.09
ICICI Bank Hourly 0.21
Tata Motors Hourly 0.89
ITC Hourly -0.24

 

 

Once again the system trumps (though if you were to observe closely, expectancy is in dangerous area for stocks such as ICICI Bank & Reliance while it out right loses money on ITC.

While we cannot decide based on above data as to whether the system is good or not, what it does show is that there is some amount of skill and its not entirely due to luck.

We next move back to Nifty F1 on Daily time frame and test the result using the Bootstrap method as well as Monte Carlo Testing.

The p-value using Bootstrap for Nifty F1 (Daily) comes to 0.55 which is way above the null value requirement of 0.05 to reject the thesis that the results seen above are based on random luck. In fact, the 0.55 number indicates that 55% of the result probability is just due to random luck and no more. This is pretty damming evidence of the fact that while our system seems to perform great, it actually is nothing more than a lucky streak.

Lets move forward and test our hypothesis using Monte Carlo Analysis. Once again, we are looking at the whether our result is based upon blind luck or is there something worth while.

Before we get into Equity Curves, lets compare and contrast a few other details.

In our regular back-test, we get a max draw-down of 19.70%. In contrast, the 95 percentile says that the probability is high that we may see a draw-down as high as 60%.

In our regular back-test we see a maximum losing steak of 7 trades while in the Monte Carlo approach, the figure comes to 20

And finally, lets look at  the various ways in which our equity curve could have been plotted. We ran a total of 10000 stimulations and as expected, chart is messy. But what is does show is the high probability (test of the lower line) of the system losing more than 50% of capital and hence running out of capital.

Eq

But should we be surprised with the answer that this system is not suitable for trading since far too many trades hinge on luck than actual skill?

Too many traders believe that one can come up with great system by just optimizing data. If only life was that simple, we would all be chilling out in our favorite place while the system kept earning for us without a sweat 🙂