SuperTrend Indicator Help

Optuma Forums Optuma Scripting SuperTrend Indicator Help

This topic contains 2 replies, has 3 voices, and was last updated by Avatar Thomas F. 1 month, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #52463
    Avatar
    Mandeep
    • Topics: 22
    • Replies: 12
    • Posts: 34

    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
    Matthew
    • Topics: 4
    • Replies: 165
    • Posts: 169

    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
    Avatar
    Thomas F.
    • Topics: 21
    • Replies: 25
    • Posts: 46

    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.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close