Tradingview – HLHB Forex Trend-Catcher System

This week we will be raiding once again for a strategy to implement on Tradingview! It is not the first time we have used this site and may not be the last time! It is one of the few sites where authors put their neck on the line and publish complete trading systems for free. As such, regardless of the results, we should appreciate that there are people out there willing to provide these resources that we can all learn from.

HLHB Forex Trend-Catcher System

The strategy was authored by Hucklekiwi Pip back in 2015 and is still being updated today. She says that the system was designed to simply catch short-term forex trends. At its heart, the system is a simple EMA crossover strategy with a couple of other indicators used for confirming entries.

Let’s take a look at the rule-set.


  • EMA (5)
  • EMA (10)
  • RSI (10)
  • ADX (14)

Entry Criteria

  • Long
    • EMA 5 crosses over EMA 10 and,
    • RSI crosses over the 50 level and,
    • ADX > 25
  • Short
    • EMA 5 crosses under EMA 10 and,
    • RSI crosses under the 50 level and,
    • ADX > 25

Exit Criteria

  • Take profit at 400 pips
  • Trailing stoploss at 150 pips
  • An opposite entry signal occurs (flip the position)
  • Close all positions at the end of the week.

Further Reading

For full details of the system, head over to Baby Pips and take a look at the following articles:

The strategy has been updated a few times. This implementation attempts to follow the latest ruleset. However, there are several updates and experiments that have been performed over the years. As such, it is possible that something is missing.

The Code

Strategy Commentary

As this post is not a pure coding tutorial, we will focus less on the syntax and mechanics of pine script. Instead, we will use this section to discuss and explain the operation and features of the strategy.

As mentioned above, the code attempts to follow the HLHB Trend-catcher strategy as closely as possible. This means that the default settings have been implemented according to the authors rule-set. However, for flexibility, inputs have been provided for as many variables as possible so that you can tweak the strategy to suit your own needs.

ADX Filter

The ADX filter was added as a strategy update/tweak to the system. As such, the feature has a toggle to make this filter optional. This will allow users to see the difference between using the filter and not. When activated and ADX is above the minimum level (default of 25), then the background will change color to orange. This indicates that the filter is ready to allow trades.

Weekly Session End

One of the exit criteria of the strategy is that all positions must be closed out at the end of the week. The author states in her article that she uses 4pm on a Friday as her end of week cut off.

This has been implemented but the logic regarding how we close the position can be a bit confusing to wrap your head around. Therefore, it makes sense to explain it in more detail here. Essentially, every time we receive a new bar of data we make a simple check to see if the current time of the candle is on or after the close time. Once we detect this is true, we send a market order to close the position. That last sentence is very important as it means that if we input 4pm as our time to close the position, we will only detect that it is time to close the position when a bar is received whose time is 4pm or after. This means that if we send a market order at 4pm, the earliest the order will be executed shall be the open of the following bar.

If that is still confusing, it could be because Tradingview reports the time of the bar as the opening time. You can see this if you move to live data. In the example below, the real time is 48 minutes past the hour. However, the time of the bar is reported as 30 minutes past the hour (which was the open). For historical data, this is the time that the script will see until the next bar is received.

So as a user, you will need to adjust this to find a suitable closing time for your timeframe! If you want to close as close to 4pm as possible, you might set Weekly Session End (Hour) to 15 and Weekly Session End (Minute) to 45 when you are on the 15-minute timeframe. This would send an order to close at 3:45pm and would be executed at the open of 4:00pm.

Plotting Overview

The following chart gives a little overview of some of the not so obvious chart elements.


Overall the results are ok. However, it should be noted that the strategy often will enter and exit on the same bar using the default stop loss and take profit settings. This can be problematic in back-testing. Especially with trailing stops on Tradingview! Therefore be a little cautious. When testing with historical data we never really know if the high was hit first or the low. This forces the backtesting engine to make an assumption and it can lead to unrealistic results. As such, if you are interested in trying out this strategy and you want to keep the default settings, you should also forward test it with live data. This will ensure trades are entered and exited correctly on each bar as with live data we do have the information about what is happening between the openand closeof the bar. For a further supporting info, see our repainting guide.

(Click on the images below to enlarge)





Support The Site!

If you like this article and are thinking to become a Tradingview subscriber, you can support the site by clicking on the affiliate link below before signing up!