I have almost done formula for supertrend script. Still can't get it done.
SET FACTOR = 2
SET PERIOD = 10
SET HL2 = (HIGH + LOW) / 2
#TODO: Instead of True Range, we need Avg. True range * periods
SET UP = HL2 - (FACTOR * TR(PERIOD) )
SET DOWN = HL2 - (FACTOR * TR(PERIOD) )
SET TRENDUP = ( REF(CLOSE, 1) > REF(TRENDUP,1) )
SET MAX = MAXOF(UP, REF(TRENDUP, 1))
SET TRENDDOWN = ( REF(CLOSE, 1) > REF(TRENDDOWN,1) )
SET MIN = MINOF(UP, REF(TRENDUP, 1))
SET UPTREND = IF(TRENDUP , MAX , UP)
SET DOWNTREND = IF( TRENDDOWN , MIN , DOWN)
SET TRENDUPCONF = IF( CLOSE > DOWNTREND, 1, 0 )
SET TRENDDOWNCONF = IF( CLOSE < UPTREND, -1, 0 )
#TODO: SET ALL VALUES. HOW TO ENABLE SIGNAL IF ITS TRUE?
TRENDUPCONF = 1 AND TRENDDOWNCONF = 0
Sorry for the late reply, my attempt though logically correct and working in parts would only result in Pi crashing, even though I have a pretty great config. Either way I’ll share it with you if I can find it, haven’t used Pi from a long time as I am not allowed to trade anymore due to my job.