In this tutorial, you’ll create an Indicator to automatic draw TrendLines in TradeStation.

Firstly, we calculate the maximum and the minimum of the last X candles or days.

This is only an example, you can create your trendline indicator simply replacing the HighestHigh and LowestLow value.

In EasyLanguage is possible to determine the Min-Max with two functions:

HighestHigh = Highest(High,BackHigh);
LowestLow = Lowest(Low,BackLow);

Drawing TrendLines by hand could be a boring activity. With TradeStation you can create a Trendline Indicator that automated the process.

TLID = TL_New(StartDate, StartTime, StartValue, EndDate, EndTime, EndValue);

TLID is a variable that contains the TrendLine ID. This is a unique identifier and is useful if you will draw many trendlines in your chart.

TL_New is a reserved word that uses six parameters to draw a new trendline.

Inputs:
BackHigh (20),
BackLow (20);

Vars:
TL_HIGH(1),
TL_LOW(2),
HighestHigh(0),
LowestLow(0);

HighestHigh = Highest(High,BackHigh);
LowestLow = Lowest(Low,BackLow);

If lastbaronchart or lastbaronchartEX then

Begin
TL_HIGH = TL_New(Date[BackHigh], Time[BackHigh], HighestHigh, Date, Time, HighestHigh);

TL_LOW = TL_New(Date[BackHigh], Time[BackHigh], LowestLow, Date, Time, LowestLow);

End;

01-Trendlines-TradeStation-Multicharts

TrendLine Indicator Tradestation

Very simple! Do you like to personalize the TrendLines?

You can choose the color, the size, and the style.

TradeStation EasyLanguage TrendLine Indicator Code:

Inputs:
BackHigh (20),
BackLow (20),
TL_HIGH_COLOR(DarkGreen),
TL_LOW_COLOR(DarkRed),
TL_HIGH_SIZE(2),
TL_LOW_SIZE(2),
TL_HIGH_STYLE(2),
TL_LOW_STYLE(2);

Vars:
TL_HIGH(1),
TL_LOW(2),
HighestHigh(0),
LowestLow(0),
TimeStorage(0);

HighestHigh = Highest(High,BackHigh);
LowestLow = Lowest(Low,BackLow);

If lastbaronchart or lastbaronchartEX then

UpdateTrendLine

Begin

TL_HIGH = TL_New(Date[BackHigh], Time[BackHigh], HighestHigh, Date, Time, HighestHigh);
TL_SetColor(TL_HIGH,TL_HIGH_COLOR);
TL_SetSize(TL_HIGH,TL_HIGH_SIZE);
TL_SetStyle(TL_HIGH,TL_HIGH_STYLE);

TL_LOW = TL_New(Date[BackHigh], Time[BackHigh], LowestLow, Date, Time, LowestLow);
TL_SetColor(TL_LOW,TL_LOW_COLOR);
TL_SetSize(TL_LOW,TL_LOW_SIZE);
TL_SetStyle(TL_LOW,TL_LOW_STYLE);
End;

01-EasyLanguage-Trendlines-TradeStation-Multicharts

With the TradeStation TrendLine Indicator in Easyanguage you have to refresh the chart (Ctrl+R) when you want to redraw the trendlines.

 

Resources:

INVESTOPEDIA

 

 

Leave a Reply