2. The First Script. SMA Crossover, Parabolic SAR strategies

In this Lesson you will learn:

  • Script editor and its properties
  • Blocks of the visual editor
  • How to work with the "Script Management" window
  • Different tabs in TSLab - Historical trades and their parameters, Optimization tab, Profit tab, Logs, Chart
  • How and why to plot different values on a separate scale
  • How to create a basic script

You will build your first fully functional simple scripts for two strategies:

  1. Simple Moving Averages crossover
  2. Parabolic SAR strategy



Practical TIPS!

You can see a detailed description of any block, its input, output, parameters and a link to an example. Select a block - Properties - Detailed


Issue: Your chart has shrunk in a small band, has been flattened.

Solution: Plot data on different scales or chart panels. All the indicators that relate to the price, such as are the moving averages, various price channels, pivot points should be placed on the same panel with the price of the instrument. Everything that is NOT directly related to the price, for example, volume, ATR, various oscillators, should be placed on a separate scale, and preferably on a separate panel of the chart.



Lesson 2 Homework

Create a script using the following algorithm:


Instrument: Futures SP 500 E Mini, ES

Timeframe: 15M

Period from 01.01.2017 to 01.01.2018

Download ES quotes for this script here. Select ES 20170101_20180101_UTC.txt

Data Provider Settings:

Number of decimals: 2

Price Step: 0.25 point

Lot size :50

  • Open a long position when the candle closes above the Parabolic SAR indicator (the price crosses the indicator from the bottom up )
  • Exit the position when the candle closes below the Parabolic SAR indicator
  • Keep the indicator (Parabolic SAR) parameters values ​​as set by default. The indicator is located in the toolbar in the “indicators” column.


Compare your answer with the Model Answer.


Model Answer Script

Download the file "Lesson_2_Model_Answer.tscript" to you PC without opening it. Then open TSLab and download the file by clicking the "Load from file" button. Open the script.

Discussion

6 comments