Creating a Moving Average Crossover Indicator
This tutorial explains how to create a custom moving average crossover indicator. A moving average crossover is when two moving averages of different periods cross one another. One of the most used pairs is the 50/200 day moving average. So we’ll use that pair for this example.
Open the indicator builder by picking the Indicators tab from the top menu. Now select Greater than from the drop down menu.
Greater than has two operands. Set both of these to Moving Average.
We set the first moving average to have a period of 50 bars, and the second to have a period of 200 bars.
Check that it works by clicking the spy glass icon on the top row. This should show a chart something like the one below.
The resulting chart shows where the fast moving average, namely the 50-day is greater than the 200 day moving average.
But since we’re interested in the crossover events, we need to add another operator. Select the Greater than operator by clicking on it. Now click the Plus icon (+) from the toolbar. This should add a new row above the one selected.
Select the Gradient operator from the drop down box. Open the parameters for the Gradient and set the shift value to 1 bar. Then click save from the parameters form. We can then check that this works by clicking the spy glass icon on the top row. It should display a chart like the one below.
The gradient is positive only where there’s an upwards crossing and is negative where there’s a downwards crossing of our moving averages.
This completes the logic for the indicator. We could filter this further to create a buy signal on an upwards cross and sell signal on a downwards crossover. For this example, we’ll just create a buy signal on any crossover.
To do this, click the Plus icon (+) from the toolbar and select a Buy operator. Then click preview again. The chart should show the buy signals being generated for each crossover event.
To see how it performs on a stock for example, we can set the chart to Facebook (FB). Then click preview again to create a chart as shown below.
The crossover indicator performs better on Facebook in this example, than it did on the currency.
Finally we can save the indicator by clicking the disk icon from the top toolbar and entering a name.