Supertrend values mismatch

mailboxofrafiq
@sujith

I coded super trend using Java and arrived at values (refer attachment values.jpg & capture.jpg)...
When I compared with values in kite.. they are not matching.. can you please help?

I used following algorithm:

ATR period is 11 & multiplier is 2..
from date is 2018-03-15 09:15
to date is 2018-03-15 15:30

BASIC UPPERBAND = (HIGH + LOW) / 2 + Multiplier * ATR
BASIC LOWERBAND = (HIGH + LOW) / 2 - Multiplier * ATR

FINAL UPPERBAND = IF( (Current BASICUPPERBAND < Previous FINAL UPPERBAND) or (Previous Close > Previous FINAL UPPERBAND))
THEN (Current BASIC UPPERBAND) ELSE Previous FINALUPPERBAND)
FINAL LOWERBAND = IF( (Current BASIC LOWERBAND > Previous FINAL LOWERBAND) or (Previous Close < Previous FINAL LOWERBAND))
THEN (Current BASIC LOWERBAND) ELSE Previous FINAL LOWERBAND)

SUPERTREND = IF((Previous SUPERTREND = Previous FINAL UPPERBAND) and (Current Close <= Current FINAL UPPERBAND)) THEN
Current FINAL UPPERBAND
ELSE
IF((Previous SUPERTREND = Previous FINAL UPPERBAND) and (Current Close > Current FINAL UPPERBAND)) THEN
Current FINAL LOWERBAND
ELSE
IF((Previous SUPERTREND = Previous FINAL LOWERBAND) and (Current Close >= Current FINAL LOWERBAND)) THEN
Current FINAL LOWERBAND
ELSE
IF((Previous SUPERTREND = Previous FINAL LOWERBAND) and (Current Close < Current FINAL LOWERBAND)) THEN
Current FINAL UPPERBAND
  • mailboxofrafiq
    @arkochhar any idea on this please?
  • arkochhar
    @mailboxofrafiq, indicators that are based on moving averages usually need lot of candles to smoothen out before accurate computations start to appear. So if you are looking at 15 minutes of ST for today, give sufficient candles from the past. I would recommend starting with T-5 days of candles.

    I have noticed that ST indicator on Pi platform in not accurate but kite is fairly accurate. Suggest you also verify your code with ST values from TradingView for different timeframes.

    Hope it helps.
  • phantomdrake
    Hey @mailboxofrafiq would you be able to share your Supertrend Java code.
Sign In or Register to comment.