1.0.6 • Published 2 years ago

supertrend-indicator v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Install

npm i supertrend-indicator

Use

const SuperTrend = require("supertrend-indicator");

let superTrendData = SuperTrend(data, 2, 10) // 2 is multiplier, 10 is atr period/length

Input data format

[
  { high: 17646.65, low: 17383.3, close: 17625.7 }, 
  { high: 17827.6, low: 17593.55, close: 17805.25 },
  { high: 17944.7, low: 17748.85, close: 17925.25 },
  { high: 17797.95, low: 17655.55, close: 17745.9 },
  { high: 17905, low: 17704.55, close: 17812.7 },
  { high: 18017.45, low: 17879.15, close: 18003.3 },
  { high: 18081.25, low: 17964.4, close: 18055.75 },
  { high: 18227.95, low: 18128.8, close: 18212.35 },
  { high: 18272.25, low: 18163.8, close: 18257.8 }
]

Output

[{
    upperBandBasic: 18405.743933263573,
    lowerBandBasic: 17611.256066736427,
    upperBand: 18350.268933263575,
    lowerBand: 17611.256066736427,
    supertrend: 17611.256066736427,
    trendDirection: 1
  },
   {
    upperBandBasic: 18350.268933263575,
    lowerBandBasic: 17555.78106673643,
    upperBand: 18350.268933263575,
    lowerBand: 17555.78106673643,
    supertrend: 17555.78106673643,
    trendDirection: 1
  },....]

trendDirection = 1 implies UPTREND, trendDirection = -1 implies DOWNTREND

Bonus

For Supertrend Strategy checkout my youtube channel - Shivakumar Anandhan