Select Page

# SuperTrend Indicator Help

Optuma Forums Optuma Scripting SuperTrend Indicator Help

Viewing 5 posts - 1 through 5 (of 5 total)
• Author
Posts
• #52463
Mandeep
• Topics: 45
• Replies: 22
• Posts: 67

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

#52555
Matthew
• Topics: 5
• Replies: 521
• Posts: 526

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

#53331
Thomas
• Topics: 114
• Replies: 152
• Posts: 266

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.

#58021
Mathew
• Topics: 40
• Replies: 2,010
• Posts: 2,050

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

###### 1 user thanked author for this post.
#58621
Darren
• Topics: 69
• Replies: 738
• Posts: 807

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!

• This reply was modified 1 year ago by Darren.
###### 2 users thanked author for this post.
Viewing 5 posts - 1 through 5 (of 5 total)
• You must be logged in to reply to this topic.