Are you searching for a fast way to programming your custom indicator in EasyLanguage and PowerLanguage? This quick EasyLanguage Tutorial is designed to make the task of learning to code more accessible.
Generally, the programming tutorials start from the coding theory. It’s complicated and boring for a newbie. Conversely, we begin with a real case and with practice.
Traders don’t need to understand everything about programming; they often need only a simple indicator that they can’t find in their trading platform.
The language is called “EasyLanguage” because it must be simple!
If you follow this series of EasyLanguage tutorials, you will be able to realize your project.
We start from many fundamental indicators, and we show you how to add many interesting features that help you in your trading activity.
Create an indicator: EasyLanguage Tutorial
Click on “Apps” and choose “EasyLanguage”; TradeStation will open a new window with the Editor.
In the Editor window, click on “New” bottom, choose “Indicator” and write the name of your new indicator.
Click on “File”, “New” and choose “PowerLanguage Editor” and MultiCharts will open a new window with the Editor.
PowerLanguage – EasyLanguage MultiCharts Editor
In the Editor window, click on “New” bottom or click Ctrl+N, choose “Indicator” and write the name of your new indicator.
How to use the EasyLanguage average function to create a Moving Average
1. Insert all Inputs
You can assign a default value to the inputs. In Easy Mode, you have to decide only the Period of your moving average.
Input can be:
- Boolean (True/False)
// EasyLanguage Comment
If you want to learn more: EasyLanguage Tutorial – The Inputs
2. Declare all Variables
The variables hold all values; for example, you will declare the “MA” or “MA_Value” variable to store all Moving Average values.
There are three types of variables:
- Boolean (True/False)
There are three Numeric Variable types:
You can choose any name for your Inputs and Variables, except for some special characters ($ % & / ).
ADVICE: you must always choose a name that has meaning. After some months, you have to open the code and immediately understand what a variable refers to.
Finally, there are many pre-declared variables, you can use them like other variables, but they don’t need to be declared. You can use this to test a draft program.
- Condition1 = ……
- Value1 = …..
Variables can reference previous bar values on any historical bar. To do this, you can use the square-bracket:
Close –> the Closed Priced of 3 bars ago
3. The calculations
EasyLanguage and PowerLanguage calculate only in Bars. Every time you use an indicator, you have to choose the number of bars to be analyzed.
If you want to learn more, read this:
We are here to calculate a moving average. TradeStation and MultiCharts are straightforward and have many pre-built functions. You don’t have to write extended code because you can use a pre-built function like AverageFC() that calculates your moving average.
AverageFC() function will use the Close price and your MA_Period input to calculate the MA.
4. Draw the indicator
The last step is to draw your indicator in a chart. To do this, you can use another pre-built function: Plot1().
With Plot Function, you can draw many indicators in the same chart; you only have to add many functions changing the number: Plot1() Plot2() Plot3 (), etc.
5. Compile the program
The last step is to click on “compile” and verify if the code is correct in the output window. If you find an error, you must fix it before using the indicator.
That’s all! The first part of our EasyLanguage Tutorial is finished.
In this part of the EasyLangauge tutorial, we add many user-friendly features. With the basic Moving Average, you can’t choose the color, the width, and the price. You can only select the MA Period and add another moving average.
1. User-friendly Inputs – EasyLanguage Tutorial plot name variable
Add all the inputs you need. When you add the indicator to the chart, you’ll choose the color, width, and price to calculate the Moving Average (Close, High, Low, Open).
Remember to separate the Inputs with a comma and to use a semicolon after the last input.
Add the correct inputs to the AverageFC() function.
2. Change the Plot1() function. Here you have two streets:
Simple: add your input directly in the Plot function.
Advanced: add another two functions to set the color and the width. You can use the Set
That’s all! Now your menu is complete and user-friendly.
If you liked this EasyLanguage tutorial, please share it!