**Example #1: Study on Study (MA of RSI)**

Introduction

The Formula Wizard allows you to use the values of a built-in study as the input for other built-in studies. In this example, we will build a 5 period moving average of an RSI study, and plot both in the same axis.

## Formula Configuration

** **

### Study Configuration

We will name our study MA of RSI , and select **non-price study** in order to plot our data in a separate axis.

### Data Plots

Add two data plot lines here, one for the RSI, and one for the moving average of that RSI. Color the MA-RSI differently than the RSI in order to tell them apart on the chart.

### Min/Max Plot Values

When plotting a non-price study, you have the option of restricting the min and max values of the study. As this is essentially an RSI plot, all values will lie between 0 and 100 on our chart.

## Studies Used

### Adding the RSI Study

This formula requires the insertion of an RSI built-in study. Click on "Add Study" and select the default values for RSIStudy:

Adding the Moving Average Study

Next, we want to insert a moving average study that uses the RSI as the input data for its calculations. Click on Add Study again, and select MAStudy:

Note the drop down arrow to the left of the constructor MAStudy(). Clicking on this drop down arrow will reveal another constructor MAStudy(length,offset,studyVarName,dataSeriesID, movingAverageType):

Selecting this 2 ^{nd} constructor will allow us to use our previously inserted RSIStudy as the input data for calculating this moving average:

Note that in the studyVarName parameter, the Function Editor has automatically filled in the variable name of our RSIStudy: vRSI14. The dataSeriesID specifies which data series within the studyVarName to reference in its calculations. The RSIStudy only has one data series ( RSIStudy.RSI), other studies, such as the MACD have more than one ( MACDStudy.FAST, MACDStudy.SLOW, MACDStudy.HIST and MACDStudy.SIGNAL).

After accepting these values, the Studies Table should now show the following:

Expression Sets

Since our study only returns the RSI and MA-RSI calculations, we do not need to add anything in this section.

Returned Data Points

We now need to return the values of vRSI14 and vEMA5_of_vRSI14. Click on Edit for each of the return lines and select the appropriate variable to return:

Results

After saving the formula to an EFS file, it may be applied to a new Advanced Chart. You should see something similar to this:

Return to Formula Wizard Guide

- Example #2: Alerts on MACD Crosses
- Example #3: Three Bar Breakout Trading System