SuperTrend Indicator Help

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

Hi Mandeep,

This tool uses two recursives within a single function which is not compatible with our scripting language at this time. To achieve this in Optuma you would need to code it in the Pascal based custom tool programming module.

https://help.optuma.com/kb/faq.php?cid=4

Hi Mandeep,

I want give you some suggestions about some alternatives for your SuperTrend Indicator that are already available as tools/indicators in Optuma.

The closest match to your SuperTrend Indictor is the “Wilder Volatility Stop” indicator.

The second one is the “ATR Trailing Stop” indicator but with this indicator you have to do the switch between up and down trend manually.

The third alternative is the “Fixed Days High Stop” and Fixed Days Low Stop”. But as with the “ATR Trailing Stop” indicator you have to do the switch between up and down trend manually.

Hope this is of help for you.

I’ve had a look at the scripting and it is a little hard - we’ll see if we can add it into Optuma 1.6

Hi Mandeep,

Just to let you know that the SuperTrend tool will be available in 1.6. You will also be able to create script formulas for scans, such as close crossing the SuperTrend ie change in trend. Look out for update news in the next couple of weeks!

Capture