Easylanguage Essentials Pdf

TradeStation EasyLanguage Tutorial
Multiple Output Functions
In this TradeStation EasyLanguage Tutorial we will show one of the most powerful methods in TradeStation EasyLanguage, which is developing multiple–output functions using by ref parameters. This concept allow you to write very reusable functions and we will use several TradeStation functions in our example.

Free TradeStation EasyLanguage Code Download. Our goal here at UsingEasyLanguage.com is to help traders better use TradeStation and to help them learn how to do useful things with it. We will make available to our site members free TradeStation code. We will be adding Free TradeStation EasyLanguage code on a regular basis. EasyLanguage Essentials. Programmers Guide - PDF Free Download i EasyLanguage Essentials Programmers Guide ii EasyLanguage Essentials Programmers Guide Important Information and Disclaimer: This book discusses how TradeStation EasyLanguage allows you to develop.

A basic user function framework

User functions are used to make reusable calculations, for example to calculate indicator values, sorting, and so on. User functions have input parameters. These parameters can be either input parameters or input/output parameters. These parameters can also have various types. Some of these types are NumericSimple, NumericSeries, NumericRef, StringSimple, numericarrayref, numericarray, and StringRef.

A function can return a single value, but when we use byref, we can return many values from a function. Let’s look at several function shells. ByRef passes the memory address of a variable which we can then fill the contents of that memory address within the user functions. That is how byref works. Normal parameters, such as NumericSimple, NumericSeries, and Stringsimple all just copy the contents to an address on the function stack. This means it can copy data into the function but can not modify the values that are passed in. Only the variable types with Ref suffix can be modified.

Easylanguage Essentials Pdf Full

Let’s first look at a simple moving average function:

We can see that we can pass a price series. This series can be a scalar or a system for example Close, High or (Close+High+Low)/3 which would be a scalar which will be passed though and converted to a numeric series. We also have the Length parameter which is a simple numeric value. Another interesting thing about this function is the use of the error trapping routine for divide by zero.

Easylanguage

Let’s now look at a simple example of using input/output variables.

This is a very powerful concept. In TradeStation, the best example of how to use this concept is in the linear regression functions:

This function gives us all of the variables that are used in regression models. Let’s look at the inputs for this function:

Easylanguage Essentials Pdf Download

We can see that we can predict any number of bars in the past or future, we can return the slope, angle, intercept and the value. This allows this one piece of code to be used for many wrapper functions as well as in more complex models and systems and only do these calculations once. Let’s look at an example of how TradeStation used this in a wrapper. Let’s first look at the complete linear regression function.

We will now create a linear regression slope function which uses the multiple output function from above. This is an example of creating these super functions and using wrappers to use them for multiple purposes.

Easylanguage Essentials Pdf Free

I hope this tutorial has explained how to use byref and make functions which return multiple outputs and how they can be used to simplify developing complex code and make valuable reusable functions.