Hi,
I’ve been trying to code the Supertrend indicator (similar to WVS()) but havent been able to complete this. This is my code so far:
varup1 = ((high()+low()) / 2) + 3*atr();
varup2 = ((high(OFFSET=1)+low(OFFSET=1)) / 2) + 3*atr();
vardown1 = ((high()+low()) / 2) – 3*atr();
vardown2 = ((high(OFFSET=1)+low(OFFSET=1)) / 2) – 3*atr();
finalup = if((varup1 < varup2) AND close(OFFSET=1) < (I’m getting stuck from here)
plot1 = var1;
plot2 = var2;
The Original Rules
BASIC UPPERBAND = (HIGH + LOW) / 2 + Multiplier* ATR
BASIC LOWERBAND = (HIGH + LOW) / 2 – Multiplier* ATR
FINAL UPPERBAND = IF ((Current BASIC UPPERBAND< Previous FINAL UPPERBAND) and (Previous close < Previous FINAL LOWERBAND)) THEN (Current BASIC LOWERBAND) ELSE Previous FINAL LOWERBAND)
FINAL LOWERBAND = IF( (current BASIC LOWERBAND > Previous FINAL LOWERBAND) and (Previous Close < Previous FINAL LOWERBAND) ) THEN (Current BASIC LOWERBAND ) ELSE Previous FINAL LOWERBAND )
SUPERTREND = IF (Current Close <= Current FINAL UPPERBAND) THEN current FINAL UPPERBAND ELSE Current FINAL LOWERBAND
any help would be appreciated. I’m stuck on the Final Upper/Lowe Bands.
cheers
Mandeep