Trading System: How to Code a Short Selling System (Plus Results)

Short selling is not often discussed properly in normal investment forums – and with good reason.  I read recently that in 1950 the stock market was in a Bull Market (moving upwards) 70% of the time.  Today that figure is around 85% of the time.  In other words – the stock market has an upward bias, and we don’t often think about making money when a market falls until the market has actually fallen.

A few days ago, Joe at JB Marwood.com wrote a great article on a short selling trading system.  He gave the results of the system on the Russel 3000 universe of shares, and the results were pretty decent, at around 19% per annum with a 17% maximum drawdown.

Then Nick Radge at the Chartist wrote another excellent article on that same system, but trading on the Australian Market.  His results were also decent, at around 11% per annum.

Below, I show you how I would code this trading system quickly and simply in Amibroker, the results I got (quite different – it may surprise you), and a few reasons why this strategy doesn’t work for me personally (hint: I’m talking risk to reward here).

Check it out!

So you’ve seen the results, based on:

  • On the ASX Top 300, including delisted stocks.
  • From Jan 2000 to November 2015 (15 years)
  • Taking up to 10 positions at a time, with 10% of the total portfolio in each

The results were:

  • -1.25% return per year
  • 25.91% maximum drawdown
  • 47 trades in total
  • Win percent 51%
  • Average profit: 13.64%, average loss 22.03%

Here is the code:

SetOption(“maxopenpositions”, 10);
SetPositionSize(10, spsPercentOfEquity);

CloseFiveDaysAgo = Ref(C, -5);
SuperNova = C > CloseFiveDaysAgo*1.8;  // could also use ROC(C, 5) > 80;

Short = SuperNova AND V > 500000 AND C > 0.05 AND C < 20;
Cover = 0;
ApplyStop( stopTypeNBar, stopModeBars, 5, 1 );

A Few Caveats

I’ve posted my code, because my results were different from both Joe’s and Nick’s – both of whom I respect as coders and traders.  So if my code is wrong – feel free to point it out!

Apart from that, the difference may simply be in the universe of stocks – 47 trades isn’t enough to make 15 years of a portfolio.  [edit: Nick and Joe have since kindly pointed out that it was most likely the universe of stocks that made the difference – not many stocks jump 80% in 5 days so the larger the universe the better).

Lastly – I noted in the video that I would not trade this myself.  Short selling has one problem – your downside is potentially unlimited, while your upside (the money you make if a stock falls) IS limited.  This is not the kind of risk to reward scenario I would ever consider, if I wanted to keep my hat in the markets over the long term.

Now I simply live by my principles, and trade simply yet consistently to my goals.

Happy trending,

Dave McLachlan

Beginners Course  |  Intermediate Course  |  Amibroker Course Home

Videos in the FREE Amibroker Course:

  1. Amibroker: How To Import A Watchlist With A CSV File
  2. Amibroker: How To Backtest A Single Stock Or Index
  3. Amibroker: How To Backtest a Portfolio or Group of Stocks
  4. Amibroker: How To Optimize A Trading System
  5. Amibroker: How To Scan The Market For Buy And Sell Signals
  6. Amibroker: How To Use Explore To Find And Filter Stocks
  7. Amibroker: How To Add Position Sizing Using AFL
  8. Amibroker: How to Add An Index Filter To Your Trading System Using AFL
  9. Amibroker: How To Plot Your Trading System On A Chart (incl. Buy/Sell Arrows)
  10. Amibroker: How to Use the If, Then Else Function (IIF)
  11. Amibroker: How to Code the ATR Trailing Stop (Chandelier) using ApplyStop
  12. Amibroker: How to Plot ApplyStop on a Chart
  13. Amibroker: How to Code Van Tharp Position Sizing (Fixed Fractional)
  14. Amibroker: How to “Scale In” to Positions (1) – Buying Once a Month
  15. Amibroker: How to “Scale In” to Positions (2) – Pyramiding Three Times
  16. Amibroker: How to Use “Cross”, When One Thing Crosses Another
  17. Amibroker Advanced: How to Compare Equity Curves

FREE Trading System Video Lessons:

  1. 7 Free Trading Systems and Their Returns From The Last 13 Years
  2. Seven Full Trading Systems Revisited, With Completely New Data
  3. Trading System: How to Create A Buy and Hold Trading System
  4. Trading System: How to Code “Sell In May And Go Away”
  5. Trading System: How to Code a Moving Average Channel That Made 23% p.a
  6. Trading System: How to Code Highest Highs As Used In 52 Week Highs Or Turtle Trading System
  7. Trading System: How to Code a Bollinger Band Breakout Trading System
  8. Trading System: How to Code a Moving Average Crossover That Returned 28% per annum
  9. Trading System: How to Refer to Previous Signals For MAup Trading System
  10. Trading System: How to Code the Leap Of Faith (Gaps) Trading System That Returned 24% p.a.
  11. Trading System: How to Code a Short Selling System (Plus Results)
  12. Trading System: Meb Faber Trading System Using Different Timeframes
  13. Trading System: How to Code the Three Billion Dollar Trading System

FREE Amibroker Q & A Videos:

  1. Amibroker Q & A: How To Do A Monte Carlo Test? (on ALL versions)
  2. Amibroker Q & A: Visualising Monte Carlo Data with Histograms and Scatter Plots
  3. Amibroker Q & A: How to Create the 52 Week High/Low Index with AddToComposite
  4. Amibroker Q & A: How to Code Trend Pilot: Five Consecutive Days Above or Below a Moving Average
  5. Amibroker Q & A: Three “Hacks” To Improve Your Coding Skills
  6. Amibroker Q & A: How to Remove Excess Signals

Read Related Articles:




  And, subscribe for free to stay in touch and receive the latest updates:

Enter Your Email Address:

.
(Check Your Junk Mail, Just In Case)

November 29, 2015  Tags: , , , , , ,   Posted in: Amibroker Trading System

4 Responses

  1. Nick Radge - November 30, 2015

    Dave,
    The key reason your results are different is because you’ve used the ASX-300. If we think about what the system is trying to do, i.e. catch stocks that have risen 80% in a few days, then you’re not going to find those in the ASX-300 – and why you only got 47 trades.

    Perhaps rerun on the complete ASX FPO list instead of just the 300.

    Nick

  2. Dave McLachlan - November 30, 2015

    Hey Nick – perfect.

    I thought that might have been it. Thank you so much! And I think you mentioned in your article that Australian brokers usually have 100-200 stocks in their short list. Tests like this certainly remind me how small our country is at times!

    Happy trending – Dave

  3. Joe - December 1, 2015

    Great video Dave.

    Just thought I’d echo Nick’s comments… I ran the system on the Russell 3000 universe and it produced over 1000 trades between 2000 and 2015. It appears to works best on the more obscure names. I also used trade delays to enter the shorts on the next day open.

    But you’re right, there are always more difficulties involved with short systems. I wouldn’t trade this one without a bit more testing first.

    Cheers.
    Joe

  4. Dave McLachlan - December 4, 2015

    Hey Joe – thank you! Great to have your eyes on it and a consensus that a larger universe helps – and it was a great article of yours to work with.

    Happy trending – Dave

Leave a Reply