First, we are adding a ClosePrices command and attaching the interval to the output of DefineEasyIndicatorsParameters. This will give us price data based on the desired interval.
Next step is adding the RSI and an Input field. Look up RSI in the commands list and attach the prices input to the ClosePrices. Right-click on the period dot of RSI and add Input. Give the command a name relavent to the RSI and a default value.
After we calculated the RSI we can smooth it. We are going to do that with the SMA. Search the command ni the list and attach the RSI output to the prices parameter of SMA. Right-click again on period dot and add an Input. Give it a SMA relevant name.
We now have a smoothed RSI as output of the SMA. In order to come to a output we need to check if the value is above or below a certain threshold. We can use the IsBiggerThan and IsSmallerThan command or we can use the GetBuySellLevelSignal. This command will return SignalLong when the value is below the buyLevel and SignalShort when the value is above the sellLevel. We can attach this result to the DefineEasyIndicatorOuput.
The GetBuySellLevelSignal command requires a buy- and sellLevel. Right-click on the dots and add one for both of them. Naming one Overbought and the other Oversold.
The indicator calculation and signal determination are both finished. We could stop but whats an indicators without a chart? Lets plot the normal and smoothed RSI. Right click on the RSI and SMA output and select Plot. For the chartIndex we will use a small trick. If we start the value with a # the engine will look in our inputs or parameters for a matching value. If we use #chartIndex here, we dont have to draw a line from DefineEasyIndicatorParameters to both Plot commands. Give the normal RSI a darker color. Its less imported and we need to know which is which.
Next are the overbought and oversold lines. We could use 2 PlotHorizontalLines but instead we are using the PlotBuySellZone. This will create a green and red line for the start and end value with a fill in between.
In order to verify our signal is correct, we are going to plot a custom signal bar. Right-click on the output of GetBuySellLevelSignal and add PlotSignalEnum. This will convert and plot a signal on the chart for us. Set the chartIndex on -2. this will plot the signal above the chart.
Save and run the script. Wait for the backtest to finish and have a look at the chart to verify the indicator is working llike it should.
If everything is working we remove the PlotSignalEnum command and save the script. We can now use this command in other scripts.