# SuperTrend

The SuperTrend indicator was invented by a French trader. SuperTrend is similar to the Parabolic Stop and Reverse System (Parabolic SAR), and is based on the median values of the candles. It measures volatility as a span between high and low, not taking potential price gaps into account. The indicator, which originates from a starting value, continues to proceed in one direction until the market changes direction, combined with rising volatility. This causes the indicator to adjust its starting value to match that of the counter-direction. The indicator is programmed in such a way that nothing but the trend direction can bring about a change. Dropping volatility combined with movements against the trend direction cause the indicator to move horizontally.

There are multiple interpretations and applications for the SuperTrend. Forex traders prefer to trade the crosses directly. This way, the system will continuously be inside the market and only needs to be complemented by a stop and further trading logic settings. Analytically speaking, the SuperTrend indicator is only able to provide information about the current trend. If the market is above the indicator, then an uptrend exists, otherwise a downtrend is in force. The indicator can be used as an exit for additional trading systems, meaning that an open position can be closed if a trend change occurs.

SuperTrend(SuperTrendMode stMode, int length, double multiplier, SuperTrendMAType maType, int smooth)

SuperTrend(IDataSeries inSeries, SuperTrendMode stMode, int length, double multiplier, SuperTrendMAType maType, int smooth)

SuperTrend(SuperTrendMode stMode, int length, double multiplier, SuperTrendMAType maType, int smooth)[int barsAgo]

SuperTrend(IDataSeries inSeries, SuperTrendMode stMode, int length, double multiplier, SuperTrendMAType maType, int smooth)[int barsAgo]

//For the values of the uptrend:

SuperTrend(SuperTrendMode stMode, int length, double multiplier, SuperTrendMAType maType, int smooth).UpTrend[int barsAgo]

SuperTrend(IDataSeries inSeries, SuperTrendMode stMode, int length, double multiplier, SuperTrendMAType maType, int smooth).UpTrend[int barsAgo]

//For the values of the downtrend:

SuperTrend(SuperTrendMode stMode, int length, double multiplier, SuperTrendMAType maType, int smooth).DownTrend[int barsAgo]

SuperTrend(IDataSeries inSeries, SuperTrendMode stMode, int length, double multiplier, SuperTrendMAType maType, int smooth).DownTrend[int barsAgo]

**double**

When using this method with an index (e.g.

**SuperTrend**(...).UpTrend[**int**barsAgo] ), the value of the indicator will be issued for the referenced bar.InSeries | Input data series for the indicator |

maType | For the calculation of the MA, the following methods can be used: |

SuperTrendMAType.HMA | |

SuperTrendMAType.SMA | |

SuperTrendMAType.SMMA | |

SuperTrendMAType.TEMA | |

SuperTrendMAType.TMA | |

SuperTrendMAType.VMA | |

SuperTrendMAType.VWMA | |

SuperTrendMAType.WMA | |

Also see:

*HMA*,*SMA*,*SMMA*,*TEMA*,*TMA*,*VMA*,*VWMA*,*WMA*. Default: HMA | | multiplier | This is a multiplier for the internal calculation of the offset. This is only used when the method is set to ATR and DualThrust. (In the adaptive mode, the multiplier uses the Homodyne Discriminator) Default: 2.618 | | Period | Number of bars used for the calculation of the moving average Default: 14 | | smooth | Values for additional smoothing If no smoothing is necessary, this value can be set to 1 Default: 14 | | stMode | The following methods can be chosen: SuperTrendMode.ATR, SuperTrendMode.DualThrust, SuperTrendMode.Adaptive The Period Parameter will have a huge influence when the DualThrustMode is selected. The smaller the period, the tighter the indicator will follow price developments. Default: SuperTrendMode.ATR |SuperTrend

if (Close[0] > SuperTrend(SuperTrendMAType.HMA, SuperTrendMode.ATR, 14, 2.618, 14).UpTrend[0])

Print("The market is in an uptrend.");

if (Close[0] < SuperTrend(SuperTrendMAType.HMA, SuperTrendMode.ATR, 14, 2.618, 14).DownTrend[0])

Print("The market is in a downtrend.");