IMG_0697_Closer

Hi, I’m Dave McLachlan. ¬†Welcome to the site.

I have both formal training and a huge passion for trading and investment methods that work. ¬†While I’m not a coder, I do enjoy figuring things out, and a lot of my work has been made available to you for free. ¬†Some content is for¬†members only.

You can access the:

You can also see the Principles I live and trade by.

Happy trending!

First Time Here?   |   Terms of Use

January 24, 2010   Posted in: Articles On Building Wealth  6 Comments

Amibroker Q & A: Three “Hacks” To Improve Your Coding Skills

Line1

Beginners Course  |  Intermediate Course  |  Amibroker Course Home

Last week I posted an article on how to code five consecutive bars above or below a Moving Average, similar to the way the Trend Pilot trading system is used.

Well, when I figured out how to do it, I figured it out the LONG way.

Two great viewers at my site graciously pointed out a total of three easier ways to code it!  Of course I checked them out myself, and even though it took me a while to understand them, when I finally did I realised how powerful these three faster methods were.

They helped me with my coding – thinking of better ways to code things – and I know they can help you too.

A big thanks to Gordon, and Maurice, and the great Cezar Alvarez, who Maurice credited.

It’s great readers and viewers that help make great things happen. ¬†Thank you so much guys!

3Hacks_1 3Hacks_2

Hope you enjoyed, and 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)

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)

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

January 31, 2016  Tags: , , , , ,   Posted in: Amibroker Q & A  No Comments

The Technical View – Current Support and Resistance Levels on World Markets

This excerpt is for educational purposes only and is not to be interpreted as trading or investment advice.  See Terms Of Use here.

This week we look at the world markets, and follow up with the single bar trade that formed a bottom on the S&P 500.  Calling these short term bottoms is one thing (which we did, hallelujah), but actually trading them is another thing entirely.  We look at how some people might manage that trade, as it unfolds.  Brilliant stuff.

We also see why the dynamic Support and Resistance of trend lines works so well – especially against the alternative of straight horizontal support and resistance.

It’s all in the video, check it out!

All Ordinaries

07_All Ordinaries_Support and resistance

S&P 500

07_SP500_Single Bar Entry and Resistance

Shanghai Composite

07_Shanghai Composite_Support and Resistance

BSE 30

07_BSE30_Channel

I hope you have enjoyed this post.  Please leave a comment below!

Happy Trending,

– Dave McLachlan

More videos from the Technical View:

  1. The Technical View – Current Support and Resistance Levels on World Markets
  2. The Technical View – Trading the S&P 500 Single Bar Reversal, plus Big, Heavy Resistance Lines
  3. The Technical View: How to Find a Market Bottom
  4. The Technical View: Targets – Head and Shoulders Compared to 2008 Pattern
  5. The Technical View – World Markets Find Support (and Resistance) at 50%

January 31, 2016  Tags: , , , , , ,   Posted in: The Technical View  No Comments

Three Trading Systems (Wk8) – Two Additions, Dry Power and “No Psychics”

This excerpt is for educational purposes only and is not to be interpreted as trading or investment advice.  See Terms Of Use here.

Welcome to Week 8 of the Three Trading Systems series!  This series looks at three trading systems, forward-testing in real time.  We get to see what happens during a draw-down, what happens when we win, Trading System ideas, discussion and more.

I’m always taking feedback – from the markets especially but more importantly from readers like you. ¬†Since¬†coming back last year I’ve found one thing:¬†the readers at this site¬†are really amazing people. ¬†You’ve been gracious with your suggestions, coding fixes, and trading ideas, and quite frankly I really appreciate having you around. ¬†And so, every week I get back to work to make more content and give those ideas back to you, too.

One such idea came from Nick recently, who wanted to see a “Golden Cross / Death Cross” (in other words a 50 day and 200 day moving average cross-over) on an index Exchange Traded Fund like STW (in Australia).Golden Cross_Long ShortObviously, the market you trade should¬†have an Index ETF as well – there are ones for the S&P 500 or FTSE and I’m sure the BSE :)

Given that¬†the Golden Cross has had a lot of press lately, I did up this system and tested it. ¬†The results are decent – better than buy and hold. ¬†Seeing as I have another “Index” system in the ROC and 50 Week Moving Average, I was wondering if you guys would like to see those two “Index timers” as part of the Three Trading Systems series.

They would look something like this:

Golden Cross Index Timer (All Ords)

2016_01_30_XAO GoldenCross Timer

ROC and Moving Average Index Timer (All Ords)

2016_01_30_XAO ROC Timer

Now, let’s see the current system results.

Current Three Trading System Results

Below is the chart of the returns since the Three Trading System experiment started (The All Ords are in Yellow):

2016_01_30_Comparative

It is great watching these, because I’ve re-realised one thing: no one knows the future.

What makes me comfortable during the downturn Рi.e. having a little or no position in stocks Рis the exact thing leads me to miss out on gains as the market turns around.  The Leap of Faith system has only a handful of stocks in it, which was nice in the recent falls Рbut now that market has bounced a little the Dow/Gann system is coming back better.

There is only one solution to not knowing the future, and that is to follow a tested system.

Starting this series with a draw-down is OK¬†too, as long as the system allows me to have enough capital to trade when the market turns around. ¬†In other words, it allows me to keep my powder dry for the next upward¬†move. ¬†Think about March to December 2009, after the Global Financial Crisis, where many people made 50% returns or more. ¬†You can’t do that if you¬†have¬†no capital left to trade with – so again, the only solution is to follow the tested system and its stop losses.

Leap of Faith Trading System

Starting Value: $50k,  Current Portfolio Value (since November 2015): $49,420.50

1 Year Equity Curve (with largest winner taken out):

2016_01_30_GapUp2

Current Trades:

2016_01_30_LOF

Dow/Gann Trading System

Starting Value: $50k,  Current Portfolio Value (since November 2015): $50,326.71

1 Year Equity Curve (with largest winner taken out):

2016_01_30_DowGann2

Current Trades:

2016_01_30_DG

Moving Average Channel Trading System

Starting Value: $50k,  Current Portfolio Value (since November 2015): $48,090.13

1 Year Equity Curve (with largest winner taken out):

2016_01_30_MAC_EC2

Current Trades:

2016_01_30_MAC

I hope you’ve enjoyed this post. ¬†Please leave a comment below!

Happy trending,

– Dave McLachlan

More¬†Posts and Videos in the “Three Trading System” series:

  1. Three Trading Systems (Wk8) – Two Additions, Dry Power and “No Psychics”
  2. Three Trading Systems (Wk7) – Lessons, Ideas, Tests, Drawdowns
  3. Three Trading Systems (Wk 6) – Thank you, Drawdowns, and Trading System Talk
  4. Three Trading Systems Series Week 5 – Can I Ask You a Question?
  5. Three Trading Systems Week 4 – Buys, Sells and YTD Returns
  6. Three Trading Systems Week 3 – Current Trades and YTD Returns
  7. Three Trading Systems Week 2 – Current Trades and YTD Returns
  8. Three Current Trading Systems – Buys and Sells and YTD Returns

January 31, 2016  Tags: , , , , , , , , , ,   Posted in: Trading Diary  No Comments

Does the “Golden Cross” Outperform Buy and Hold? Market Timing, Real Results

This excerpt is for educational purposes only and is not to be interpreted as trading or investment advice.  See Terms Of Use here.

A great question came across the site from Nick recently, who wanted to model a 50 day / 200 day moving average cross on an Index Exchange Traded Fund. ¬†Given the amount of press that this “Golden Cross” has had lately, I thought: “What a great idea!”.

Golden Cross_Long Short

We test the Golden Cross against a regular buy and hold approach, and it performs well.  It seems there may be some truth to the Golden Cross, when used as a market timer, after all.

Check it out!

Happy trending, and feel free to leave a comment below :)

– Dave McLachlan

More Market Research Videos:

  1. Stock Market Research: The REAL Effect of “Buy and Hold”
  2. This Simple Indicator SMASHES “Buy and Hold” Returns!
  3. More Stats on the Indicator that Beats Buy and Hold Returns
  4. New Mean Reversion Trading System (Stocks Over 50 day MA) Tested in Amibroker
  5. How This Random Entry Beat The Market (The Tom Basso Coin Flip Proven & Explained)
  6. Does the “Golden Cross” Outperform Buy and Hold? Market Timing, Real Results

January 31, 2016  Tags: , , , , ,   Posted in: Stock Market Research  No Comments

Amibroker Q & A: How to Code Trend Pilot: Five Consecutive Days Above or Below a Moving Average

Line1

Beginners Course  |  Intermediate Course  |  Amibroker Course Home

This week’s Amibroker question comes from Brendan, who asks how to code five consecutive days above or below a moving average. ¬†This is similar to how the Trend Pilot trading system works, although once we know how, we can use it for any other trading system or model we like.

In the video, we use the “Ref” function, which “refers” to previous bars.

We also back-test the Trend Pilot trading system quickly, with some good results for a solid trend following trading system.

Check it out!

UPDATE:  There are also three faster ways to code this, pointed out by some great viewers!

Hope you enjoyed, and 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)

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)

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

January 24, 2016  Tags: , , , , , , ,   Posted in: Amibroker Q & A  3 Comments