Supertrend

Category: Indicators

The Supertrend indicator is a popular tool used in financial markets to determine the direction of the price momentum and to signal potential buy or sell opportunities based on the trend’s direction. It is versatile and can be applied across various timeframes and instruments such as stocks, futures, and forex.

Syntax:

Supertrend[multiplier, N]

The parameters used in the Supertrend function are:

  • multiplier: A factor that determines the sensitivity of the trend indicator. A higher multiplier results in a less sensitive indicator that is less prone to whipsaws.
  • N: The lookback period over which the Supertrend is calculated. This defines the number of periods used to calculate the average true range, which is a key component in the Supertrend calculation.

Example:

st = Supertrend[3,10]
IF(close > st AND close[1] < st[1]) THEN
    bullishSignal = 1
ELSE
    bullishSignal = 0
ENDIF
RETURN bullishSignal

In this example, the Supertrend is calculated with a multiplier of 3 and a lookback period of 10. The code checks if the current close price is greater than the current Supertrend value and if the previous close was below the previous Supertrend value. If both conditions are met, it sets bullishSignal to 1, indicating a potential buying opportunity. Otherwise, it sets bullishSignal to 0.

Additional Information:

The Supertrend indicator typically appears as a line on a chart that dynamically adjusts above or below the price depending on the prevailing trend. When the price is above the Supertrend line, it suggests an upward trend, and it is often considered a buy signal. Conversely, when the price is below the line, it suggests a downward trend, indicating a potential sell signal. The indicator flips position based on the price movements and the parameters set by the user, helping traders to visually identify trend changes.

Logo Logo
Loading...