Trading System: How to Create A Buy and Hold Trading System

Line1

Beginners Course  |  Intermediate Course  |  Amibroker Course

Creating a Buy and Hold trading system can be good to have on hand for many reasons – probably the best one is that you can use it as a benchmark to see if your own personal trading system is outperforming or underperforming a market index.

In this video, we show you a simple way to create a buy and hold trading system in Amibroker Formula Language (AFL) so you can use it in your own analysis.

How We Enter Our Code:

  • From the main screen in Amibroker, open the formula Editor by going to Analysis > Formula Editor.
  • Type in the following code:

Buy = 1;

Sell = 0;

Alternatively we could use True instead of 1, and False instead of 0.

What This Code Means

What we are asking the program to do, is to BUY when there is a price (any price) and then SELL when that price ends.  In other words, it ends up being a buy and hold.

We can easily set the dates we want to test using the Automatic Analysis window, in the middle section where you choose “From” and “To”.

Now you have an easy way to get a benchmark for your own trading system.

I hope this helps, happy trending and enjoy!

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)

June 10, 2013  Tags: , , , ,   Posted in: Amibroker, Amibroker Trading System, Trading System

2 Responses

  1. Joe - July 2, 2016

    Hi

    Can you help me with this “problem” with Amibroker coding:

    I want to know what tomorrows stock price have to be in order for RSi(2) to cross below level 10.

    I don’t know if this is a complicated coding or not.

    Regards
    Joe

  2. David McLachlan - July 10, 2016

    Hey Joe!

    I’m sure it can’t be tooo hard, but would require more brain power than I have at the moment! If a quick google search doesn’t yield any results, try Aussie Stock Forum Amibroker thread? They are lovely there.

    Cheers – Dave

Leave a Reply