0
$\begingroup$

I'm trying to implement the Supertrend indicator. Unfortunately, I can't calculate the values ​​that my chart software generates. At the moment, I don't fully understand my problem.

You can add the Average True Range and Supertrend indicators here and look at the stock prices, but the values ​​don't add up (Chart ).

The formula to calculate the Supertrend should be:

if Close > (H + L) / 2:

(H + L) / 2 + M * ATR

else:

(H + L) / 2 - M * ATR

For example values to calculate the supertrend provided by the charting software would be:

Date Open High Low Close Supertrend ATR
01.05.22 13996.82 14589.45 13380.67 14388.35 13834.08 1226.26
01.06.22 14478.37 14709.38 12618.68 12783.77 16180.90 1312.71

With the formula I would calculate 16437.58 (instead of 13834.08) and 11038.61 (instead of 16180.90). Can anyone help?

$\endgroup$
2
  • 1
    $\begingroup$ What source/reference material are you using for Supertrend? I tried to use quantifiedstrategies.com/supertrend-indicator-trading-strategy but TBH I was not completely able to reproduce the published results either. (Maybe U and I should compare our work so far). $\endgroup$ Commented Jul 22, 2024 at 16:07
  • 1
    $\begingroup$ For example: investopedia.com/supertrend-indicator-7976167 There are much more tutorials. One reference suggests a different calculation if the close price is above or under the base price (= (high + low) / 2). If the close price is higher than the base price, we must calculate: (high + low) / 2 + 2 * ATR; if the close price is lower than the base price, we must calculate (high + low) / 2 - 2 * ATR. My attempt in LibreOffice Calc with C2 = High D2 = Low E2 = Close F2 = ATR P2 = 2 is =IF( E2 > (C2+D2) / 2 ; (C2 + D2) / 2 + $P$2 * F2; (C2 + D2) / 2 - $P$2 * F2) $\endgroup$ Commented Jul 22, 2024 at 21:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.