In this simple tutorial, we show you how to create an indicator with EasyLanguage for TradeStation and MultiCharts.

Let’s build an indicator in Easylanguage from scratch. As always, the simplest example is a Moving Average, but we will then complicate the code a bit to create something different from the one on the platform.

An indicator can be drawn in the price chart or the window below. There are also other types: – Paint bar – Show me

How to Create an Indicator with EasyLanguage

First, we declare the input relative to the speed of the moving average, in this case, we put 20 periods (4 weeks), to declare an input, the reserved word Input is used.

Input: MA_length(20);

In this case, the input is a numeric value, but it could also be a True / False or a text string.

Then the variables will be declared using the reserved word Variable (or Var, Vars, Variables)

vars: MA(0);

We pass the average calculation; this is the heart of the program. We will use the average function calculating the average based on the closing price (Close), but it can also be used Open, High or Low.

MA=average(Close,MA_length);

Finally the string of code to draw the average:

Plot1( MA, “MA”);

How to add colors

This is the moving average already present in each platform, so let’s add some other lines of code to change the color and have some additional information.

Insert the color variable:

color(white);

At this point I want the moving average to turn red when it is descending and green when it is ascending.

To do this, I’ll have to compare the average of the current candle and the previous two:

If MA>MA[1] and MA[1]>MA[2] then

color = Green;

If MA<MA[1] and MA[1]<MA[2] then

color = Red;

I will also have to modify the code part related to the drawing:

Plot1( MA, “MA”,color,0,3 );

The complete code in EasyLanguage:

Input:
MA_length(20);
vars:
MA(0),
color(white);
MA = average(Close, MA_length);
If MA>MA[1] and MA[1]>MA[2] then
color = Green;
If MA<MA[1] and MA[1]<MA[2] then
color = Red;
Plot1( MA, “MA”,color,0,3 );

The Moving Average Slope Indicator is the most popular technical indicator, it provides useful information, but often it’s not sufficient.

To program an automated trading system, often, you need to calculate the slope of the moving average.

Calculating the slope is very simple, you have to compare the last Moving Average value with the present.

This is the classic formula, but we do not like it. Comparing just two candles is too short. There are too many changes in the slope direction and therefore, too many false signals.

We prefer to compare more candles. Notice the noise decreasing.

If you use a short moving average (less than 50-periods), to avoid the noise, you have to increase the number of bars used for the calculation.

Moving Average Slope Trading System – Strategy Backtest

We created a simple Moving Average Slope Trading System to backtest this indicator.

The strategy works well when the market is trending strong.

We backtested this strategy using a 20 MA period with EURUSD Daily from 2000 to 2010, and it works.

The automated trading system buys when the slope became green and sells when the slope became red, without stoplosses and with appropriate position sizing.

After 2010 the Moving Average Slope Trading System doesn’t work because EURUSD and the other currencies lost volatility and strength. With a weak trend, there are too many false signals.

This backtest is only for statistical research in order to understand if the strategy is connected with the market.

Moving Average Slope with ADX filter

We know that when the trend is flat, the indicator starts to change directions with random movements.

We need to filter the trend intensity and try to stop the indicator when the trend is flat.

The best indicator to examine the strength of the trend is the Average Directional Index (ADX). When ADX is high, the trend is strong; it doesn’t matter if it goes up or down.

When our ADX is under 20, the trend is weak, and the Moving Average Slope can provide false signals.

Naturally, with the ADX as a filter the results of the Moving Average Slope Trading System on EURUSD 2009/2019 improve.

The strategy with EURUSD is very weak and certainly cannot be used.

Two moving average slope indicator

Another trick to limit false signals, we can add another Moving Average Slope Indicator.

So we have, for example, a 20-periods Slope MA with a 40-periods Slope MA system.

When both indicators have the same direction, the signal is stronger. To chart this, we could use a histogram.

We can use this indicator to create different Moving Average Slope Trading Systems. But remember that Moving Average is a lagging indicator and is good exclusively for trend confirmation.

Using Moving Average Slope to filter the trend

We could use this indicator in many trading system strategies to filter the direction. A lot of traders use moving averages to filter the trend. It’s important to understand there is no trend in shorter periods. If we need to filter the trend, we need to use at least at 40-period Moving Average.

This indicator is useful when you have many charts open simultaneously on your screens at your Trading Workstation at your office space and want to see the trend at a glance.

The Bollinger Bands are already present on every platform, but using the Bollinger Bands Bandwidth Indicator, the bands will be displayed only when the volatility decreases (during periods of “congestion” or during a range-bound market).

I sometimes use this filter in mean-reverting strategies to avoid signals when volatility is low. This simple correction generally improves breakout strategies.

We begin to draw the Bollinger Bands with simple code, slightly different from what you find on the platform:

After that, we have to code the slow and fast Bandwidth and its moving average:

The result will be the distance between the bands. However, we do not just need the distance, so we’ll have to compare a fast Bandwidth with a slower one. In this example, we use a 50-period moving average.

If volatility increases the Bandwidth stays above its moving average.

In addition, we insert the fast Bandwidth above the slow Bandwidth so you can have four types of volatility already usable:

The indicator will draw congestions like this:

How to “draw” Transparent Bollinger Bands

To display the Bollinger Bands BandWidth only during the phases of decreasing volatility, I used the Argb function.

With this function, we can define the colors in Easylanguage for only TradeStation and have much more flexibility than the few preset colors.

The code looks like this:

color_up=Argb(255,255,0,255);

In short, replace the first and the last value with a 0 and the color becomes transparent.

Are you searching for SuperTrend Indicator? This post if for you!

The Supertrend Indicator (ST), developed by Olivier Seban, was born as a tool to optimize the exit from trade, which is a trailing stop.

ST could be the key to unlocking predictions about future trends for intraday traders or longer term. Today is one of the most used tools by traders.

In this tutorial, we will explain what it is, how it is used, and how to calculate it. You can also download SuperTrend free versions for TradeStation, MultiCharts, MetaTrader.

What is SuperTrend Indicator?

The ST Indicator ST belongs to the category of follower trend indicators. These types of indicators signal the direction of the trend and highlight the continuation or changes of direction.

The primary lesson of these indicators is for the most part: don’t open a position contrary to the trend.

And very similar in his conception to Wilder’s Parabolic SAR. However, the Supertrend has the merit of positioning itself horizontally, in a sort of stand by, in moments of price laterality, avoiding getting us out of position before time.

We must always remember that all trend-follower indicators have a common flaw: they warn of the change of trend AFTER the change has taken place, not PRIMA.

They are all indicators that update with an inevitable delay; they are not anticipators of the trend.

Let’s see the two indicators in comparison: the SuperTrend is represented with the solid line, while the Parabolic SAR with the classic green dots (up) and red dots (down).

It is immediately noticeable that the continuous color change of the Parabolic SAR gives rise to many more false signals than the SuperTrend

However, the ST has two enormous merits:

1) It is straightforward to use because the identification of the trend takes into account the average volatility of the asset.

2) It can be used with any timeframe and all financial instruments (shares, indexes, forex).

Others do not do so and, therefore, often force them to leave the market too early.

On the other hand, the SuperTrend filters many false signals, and this allows us to keep the position open for longer and increase the average profit.

A trend follower strategy to be successful must remain on the market as long as possible.

The longer you stay on the market, the more trends you can take advantage of.

At the same time, it also needs to come out quickly if the trade is going the wrong way.

How do you use the ST Indicator?

From a graphical point of view, the Super Trend appears as a red or green line that accompanies price trends.

The SuperTrend buy signal and sell signal is about more than just identifying the trend. The technical indicator does not only turn green and turn red for entry signals.

With this technique, there will be no shortage of false signals, especially in phases of prolonged laterality.

It will, therefore, be of fundamental importance to close the position in stop-loss if the market does not go in the desired direction.

We prefer to suggest that you do not use it alone but integrate it into your trading systems with the use of other tools.

Even if the ST is a very valid indicator, it is better to use it in combination with at least one other.

We can use it together with the CCI, Momentum, ADX, RSI.

Two SuperTrend Indicators – The Double Strategy

There is also the possibility to take advantage of ST not in combination with another technical indicator, but by combining two ST indicators.

We can then apply the same indicator to the graph but with two different settings, one fast and one slow.

In this case, when the fast curve crosses from bottom to top the slow curve, we have a long signal.

When the fast curve returns below the slow curve, it is time to close the operation. We practically expect both curves to have the same color.

Which timeframe to use for SuperTrend Indicator

At first, we said that the SuperTrend has the advantage of being able to be used in every timeframe.

In general, however, on intraday trading timeframes it loses its effectiveness, there is no single rule, it is advisable to make a few attempts on the financial instrument we intend to trade.

Although it should always be remembered that the real trend exists only on long time frames, so from the daily up.

SuperTrend Indicator MultiTimeFrame

Always to limit false signals, we have built a SuperTrend Multi Time Frame indicator.

You can find the article and indicator to download for free at this link.

How is the ST Indicator calculated?

The ST is calculated based on a coefficient that is applied to the average volatility of the period considered.

Once volatility is identified, the Super Trend is calculated by applying to the latter a volatility multiplier and a coefficient relative to the observation period over which volatility is calculated.

It must always be borne in mind that the higher the weight of volatility, the wider the range of tolerance before a reversal of trend occurs.

The SuperTrend Indicator Formula:

Upper=(high+low)2+ (Multiplier∗ATR)

Lower=(high+low)2− (Multiplier∗ATR)

Conclusions

Is the ST Indicator a great indicator?

The ST is, indeed, a great indicator.

However, we always remember that when long sides are formed, the Supertrend generates many false signals, but it is still the biggest flaw of all the trending indicator.

Q&A

Can I use the STfor intraday trading? It is certainly possible to use it, but we do not like it as a trading system because, in the market, the ongoing trend exists are on high timeframes. A correct ST trading strategy should be based on daily timeframes or higher.

Is it the best trending indicator? For us, it is the best trending indicator. The Super Trend Indicator is the one that provides fewer false signals, compared to parabolic SAR, for example.

Let’s build a new Tradestation Connors RSI strategy in EasyLanguage.

Today we present the excellent 2-period Connors RSI method devised by Larry Connors. We apply it to the US index using the SPDR S&P 500 Exchange Traded Fund (ETF) SPY.

First, What is the Relative Strength Index (RSI)?

From Investopedia is “The RSI is a momentum indicator that measures the magnitude of recent price changes to evaluate overbought or oversold conditions in the price of a stock or other asset“.

BUY: When the Relative Strength Index indicator is oversold below the 5 levels.

EXIT: When the price closes above the simple 5-period moving average on PriceClose.

Connors also uses a trend filter through a 200-period moving average to determine the big trend.

Today we will change the original strategy. We using an oversold level of 10 and we will not use the trend filter.

However, the system will only go long on a daily time frame. Caution: The system does not have adequate position sizing and buys $ 10,000 with an initial capital of $ 30,000 and has a huge stop loss of $ 2,000.

EasyLanguage Code for TradeStation and MultiCharts

There are many strategies that you could code in EasyLanguage for TradeStation.

This is only one alternative version.

Let’s start with declaring the inputs:

Input:

RSI_Period(2),

RSI_OverBought(10),

MA_Exit_Period(5);

Then we declare the variables:

Variables:

RSI_Value(0),

Exit_MA(0),

Max_Risk(000);

Then we code the RSI calculations for the entry signal and the moving average for the exit:

RSI_Value = RSI(Close,RSI_Period);

Exit_MA = Average(Close, MA_Exit_Period);

Finally, we insert the code to send the order and manages the exit:

If ( RSI_Value <= RSI_OverBought ) Then buy(“Buy”) this bar at close;

If ( MarketPosition <> 0 ) And ( Close > Exit_MA ) Then sell(“Exit”) this bar at close;

If ( Max_Risk > 0 ) Then SetStopLoss( Max_Risk );

This is the Trading System’s equity line and results:

Conclusions

We coded the Larry Connors RSI 2 strategy in EasyLanguage for TradeStation and we like it!

The results of our trading operation utilizing strategy: 22trades with an average profit of $44 per trade, with a very good percent of profitable trades at 70%.

We can improve it by adding a trend filter with position sizing rules. The size of the position must depend on implicit or historical volatility.

Tradestation and MultiCharts Strategy RSI Connors – Easylanguage final code: