Thursday, April 20, 2017

Stochastic Systems Analysis

Engineers will recognize that this post is about trading, others may wonder what is a stochastic system.

Market price data is a time series of mostly random data, a stochastic system.  So a Day Trader is a Stochastic Systems Analyst - now doesn't that sound fancy!

Investopedia Simulator
The one thing I learned over the years is that if you want to make money from trading stocks or futures, then you need to have a simple and well defined system, with easy to calculate entry and exit criteria, otherwise you will eventually lose your shirt.

As Douglas Adams, the famous galactic economist of Bistromatics fame said:  When it is infinitely improbably that something will ever happen, it will happen almost immediately.

Price data is mostly random.  In retrospect it seems to follow a trend and engineers and computer programmers realize that they can easily devise a system to do automated trading based on historical and real-time data with some Digital Signal Processing applied to detect a signal in the noise.  I tried it too, but downloading price data and adjusting for stock splits and companies changing names and ticker symbols is a huge problem and if you then devise an automated trading system it may work for a while, but eventually it will diverge and you can lose your shirt.   

An automated trading system requires constant work, which defeats the original idea!

Mutual Funds

The only people that make money from mutual funds are the people that manage the mutual funds.  In Canada, they make money twice - when you buy and when you sell - a total rip-off.   

So instead of investing in a mutual fund of a bank, rather buy the stock of the bank, pocket the dividends and stop complaining about how they rip people off.

Long Plays

One problem is that any trade also influences the market - it is a feedback loop.  One can get price volatility with a purchase of only a few hundred shares in a blue chip company, if nobody is selling at that nanosecond instant.  Now imagine trying to manage a pension fund and buying and selling tens of thousands of shares.  This is why there is always room for the little guy - us.

To build real wealth, you need to be in the market for the long haul - decades.  The pension funds periodically 'balance their portfolios' - usually in March and October and that can cause wild volatility and crashes.  So a good long strategy is to buy in March and sell in September, then buy in November and sell in February.  If you are in cash, then you can buy the crash.  If it doesn't crash, just buy it all back again a month later.

I just bought four blue chip stocks in my RRSP  (my buy in March entry) and within a few minutes lost $200 - bah, humbug.  If you trade long, don't look at the real-time graphs! 

To control the risk, buy at least 5 stocks for your RRSP and set stop loss orders 5% to 7% down - but you need to keep resetting them, since they expire after a few days.  Effectively, you can run your own mutual fund and keep the management fees.

Day Trading

Day trading is for making a little money to live on now.  Investing is to make a lot of money to retire on in 30 years.  It requires different strategies.

Day trading is also a nice mental exercise to keep your brain from atrophying while you wait for the  market grass to grow.

There are few millionaire day traders.  There are however many people who sell books and training courses on day trading.  Selling books and training courses is clearly more profitable and less risky!

You have to read two or three books (No more than three. Stop and practise instead), to learn the lingo and methods, just don't believe in it as the one true gospel - try to find the idea behind it

Bear in mind that if someone sounds like a second hand car salesman selling a lemon, he probably is. 

Day trading is limited by what a human being can manage.  People can juggle 3 to 11 complicated things at the same time in their head.  The result is that a futures trading system is best limited to a pot of $5000 to $15000 and trades limited to 1 to 5 per day.

As Lazarus Long, the famous American futurologist said: The odds are terrible, but if you don't play, you can't win.

If you trade with E-mini, buy and sell one or two contracts at a time, then you could make $50 to $200 a day.  Buy a contract and sell when it is up by 8 ticks or down by 3 ticks.  On average you should win some - not much, but enough to pay the bills.  If you don't know what you are doing yet, you can loose $50 to $200 a day - so you have to practise in a simulator.

The methods are the same for day trading stocks, but you would need a bigger pot of money - about $25,000 to play with -

In general, don't trade with more than 1% of your pot of money to keep the risk down and test your system in a simulator for a week or two before turning loose on live trades.  If you only make one trade a day, then two weeks of practise is only 10 dummy trades - precious little.  If you cannot make money in a simulator, then real live trading will be even worse and you will join the crowd of suckers at the bottom of the heap.

If you are good, then you should invest half your monthly profit for the long haul in blue chips.

Trading Software

Trading software programs now are a dime a dozen - there is no need to write your own anymore.  Ninjatrader is popular for futures trading, but your own bank probably has a system that is good enough - a fancy expensive program will not magically make you a better trader if you only do one trade per day.

TD Bank for example has four trading systems that I know of, the default Webbroker system, a more advanced Java based Advanced Dashboard program that you can download from the Webbroker site which provides real-time data and also ThinkOrSwim and the related TD Ameritrade -

The lowest cost reputable broker that I know of is Interactive Brokers.  If you do one trade per day of a few hundred stocks/futures, then they may be the best, but figuring out exactly how much it will cost you is difficult, since they have a complex pricing schedule -

Depending on how much you trade and how much you have in your account, a trading platform will cost about $60 per month.  So the cost is not ridiculous if you are dedicated to trading and not just doing it for fun.  Also write down the help phone number of your trading system, so that you can call them when you have a computer or network problem and cancel your trades.

Historical Analysis vs Reality

If you find an elevator stock that goes up and down, then you can trade it and make money every few hours or days simply by sitting and staring at the real-time price graph, but eventually something will change.  There will be a war, a plane crash, a court case, a dishonest CFO... and you may loose your shirt.

It is therefore important to use simple statistics and stop loss orders to control the risks and identify opportunities, but you should steer clear from very complex systems, since finely tuned systems will only work in the short term.   

By the time that you buy the book of a successful trader, he is already retired and canoeing in the Caribbean and his lucky streak has long since ended.

You can learn from the past, but the past will never be repeated exactly the same way.

Simple Statistical Analysis

The Greek philosopher Democritus said that a thing is worth whatever someone is prepared to pay for it and the stock market to me resembles a pack of lemmings running over a cliff, with traders trying to outbid each other before the inevitable market crash.

The first book I read on stock trading was clearly written by a trader who was just lucky (or had inside information).  His 'head and shoulders system' was impossible to recreate and everything worked only in retrospect, not with real data.  Successful plays almost always resemble a 'head and shoulders' graph - after the fact.   It is very easy to predict that you should have bought a stock last week.

Much later, I encountered a book by Burton Malkiel,  'A random walk down Wall Street', which rigorously proved with Montecarlo analysis that most hedge and mutual fund traders were just lucky and will blow up eventually.  It is a very dispiriting book, but it proves that one cannot predict the market by looking at price data only - you need to have inside information also.  Ordinary mortals don't have inside information, but big traders and institutions do (the managers sit on multiple company boards and are all golf buddies) and they are the ones leading the pack of lemmings.

The front running big lemmings will never admit to randomness explaining their strings of successful trades, since that will make them look dumb and they will not admit to having inside information, since that is supposed to be illegal.

Successful trading systems for small time investors invariably boil down to a price moving average and a standard deviation calculation, plus a volume indicator.  A Bollinger band is very good to see what the price is doing, while a trading volume indicator (there are many), can identify what the other lemmings are doing and the trick then, is to run with the pack just a little bit and stop, before they fall off the cliff.

The Lemming Effect

Successful trading strategies look not only at price, but also at volume and track price volatility to get a handle on the Lemming Effect.  The big lemmings out in front of the market are the institutional investors with inside information - successful small trading systems calculate how to follow the fat lemmings for a little while.


When the market is stable (going sideways) or going up (bullish), then you can buy low and sell high and make money, a little bit at a time.

However, when the market is stable or going down (bearish), then you need to reverse things to (short) sell high and buy low.  It is exactly the same operation, just reversed in time.

As Shane, the famous American cowboy said: If god didn't have a sense of humour, then he would be a very lonely man.

Here is a good write-up on Bollinger Band trading -

So how do you know when to buy long or sell short?  Look at the long term trend - where are the lead lemmings going.  Is the market going up, or going down and if you get a losing streak of five dud trades - reverse what you are doing - don't fight the market - flip your strategy around - ping-pong -

Practise Makes Perfect

It all sounds easy until you try to place a trade, then you wonder what amount to enter at the stop buy, what is the ADR and the profit target and what to enter in the stop loss and would the profit be big enough to cover the trading fees - and by the time you figured it all out, the opportunity has passed.  

Therefore you have to make a spread sheet or prepare a programmable calculator with your formulas so that you can enter and place a trade quickly.  You need to keep a spread sheet of your trades anyway, since come tax time, you will need it.

How do you find a stock to day trade?  Well, that is the boring part.  Here are some clues:
  • Daily volume between 500K->25M shares
  • Stock price < $30
  • Range between hi & low to be > 50c
  • Look for a 20c gain on 1000 shares, for a $200 day.
There are not all that many.  You could play with Bank of America in a simulator to get started.    

Keep it simple, and practise in a simulator or for a few weeks before you risk real hard earned moolah.

La voila!