Higher Highs, Bullish Trend Indicator
A way to detect a bullish trend is when the chart begins to make higher highs, and higher lows over a certain period. We’ll show here how to create an indicator to detect higher highs.
To detect these events, we can use the Max function. The Max function works over a set period and outputs the value of the maximum price over that period. For example, if a stock reaches a high of $20 over a 30-day period, then Max returns 20.
As we want to find cases where the highs are increasing, we need to look at places where the Max function is consistently rising without any drops. It should look like a staircase.
To create the indicator, go to the Indicator page & choose the builder tab.
Set the first row to a Subtract operator. Then set the first input to the Max operator.
Now change the settings of the Max operator by clicking the cogs icon. We’ll use a period of 15 for this example, but you can set this to any length. Once changed, click Save to save the settings.
Set the second input of Subtract to Array Shift. We’ll be subtracting adjacent values from the output of Max to check that the highs are rising over a period.
Now copy the Max stub to the input of the Array Shift. To do this, click the Max row. While holding down the CTRL key, drag the stub to the input of the Array Shift. The indicator builder should look like the image below.
To check the result so far, click the preview icon on the toolbar of the top row. This is a spyglass icon. The chart should look something like the one below, depending on symbol and time frame. A positive spike is showing where highs are rising, a negative spike shows where highs are falling.
Since we’re only interested in rising highs, we can threshold the output at zero. To do this, add a Threshold operator in the top row. To do this, click the top row with the Subtract operator, then click the plus symbol in the toolbar to add a new row. Set this to Threshold.
Previewing the result so far should show that thresholding removes the parts of the chart that are below the zero line, as we needed.
We can now count the thresholded result and that will tell us how many new highs were broken over a period. We’ll use the CountIF function to do that. CountIF will count a value of 1 everywhere that the operand is true (non zero).
Add a new row at the top and set that to CountIF. We’ll use a length of 10 bars for the count. Set the Threshold to the operand of CountIF. The result should look like the image above.
Click the spyglass to preview the output of CountIF. It should look something like the chart above.
We want to select places where the number of new highs matches a certain number. For the purpose of this example, we’ll use one new high. That means, with our settings, we’ll find places where the trend is breaking a new high over the past 15 bars.
Click the CountIF row, and add a new row above it. Set that row to Equals. Now click the second operand to Equals and click the cogs icon to set its value. We’ll set that to 1.
Click the Equals row and add a new row above it by clicking the plus icon on the toolbar. Set the new operator to Buy. With this logic, the indicator will create a buy signal whenever there are higher highs over a 15 bar period. We’ll use the weekly time frame for this example, so this means over a 15 week period.
Click the preview icon in the top row. The chart above shows the result for Google (GOOG) weekly. The indicator has a success ratio of 91% and each signal on average made 20.79% profit.
Testing on a different symbol, Facebook, gives a success ratio of 93% and an average profit of 27%.