We will be defining the following variables:
Simple moving average of the past 10 tickers
Value of SMA10 starting from the previous ticker
Simple moving average of the past 50 tickers
Value of SMA50 starting from the previous ticker
1) Go to the variables tab of your strategy and click on Declare a variable
2) Fill out the name, enable draw, and pick a color
3) Click on the + sign next to the Data attribute
4) Select SMA from the dropdown (you can also start typing to search for a variable or indicator)
5) Select ticker_close as SMA's source
6) Click on the + sign next to period and enter 10 (Remember that you can always enter custom values here as long as it's a number)
7) Our final variable will look like this:
8) Click on declare and you will be transfered to the Variables page once again with a new variable on the list
Lets create the remaining 3 strategies using the same steps above each with a different color.
9) SMA10 (PREVIOUS)
Select the variable we created earlier, SMA10.
Once selected, you will notice that the lookback_period is by default set to 0.
Previous values are simply selected by setting the lookback_period to 1. Click on the current lookback period 0, and remove it by hitting the backspace.
Input 1 and hit enter.
The lookback period should now look like this.
10) Declare SMA50
11) Declare SMA50 (PREVIOUS)
And now, we have all the variables we need.
Let's start using them on the next section!