Average True Range and Supertrend

I want to create a trading strategy based on Supertrend indicator. I need the exact formula for Supertrend, and if possible, the code for it. I also need help with coding the ATR (average true range).

Super trend values are calculated as follows

Up = (HIGH + LOW) / 2 + Multiplier * ATR
Down = (HIGH + LOW) / 2 - Multiplier * ATR
When the change of trend occurs, the indicator flips

Average True Range is calculated as follows

Current ATR = [(Prior ATR x 13) + Current TR] / 14

  - Multiply the previous 14-day ATR by 13.
  - Add the most recent day's TR value.
  - Divide the total by 14

1 Like

What is the MULTIPLIER in above formula? Also, where are the parameters of 7 and 3 that are used to plot Supertrend in KITE?

Thanks. Really needed a Supertrend formula

In parameter 7 and 3, 7 is the period and 3 is the Multiplier.
In the given formula we have used 14 as period (Instead of 7) .

HI
HAVE YOU WROTE ANY ALGORITHM FOR THIS SUPER TREND

Supertrend screener can be found here: http://chartink.com/screener/supertrend-positive-breakout

And modify the parameters as per your needs

Since supertrend calculation need (n-1)th row, how to do it for 0th row!