[pshaiCmd] SuperTrend Extended

1 1501 Views 3 Comments 2 years ago
  • SuperTrend Extended indicator.

    This command version provides inputs for price data, which allows to use this indicator over MACD or RSI data for example.

    Input paramaters:
    * atrPeriod : ATR period length (for example 22)
    * atrMult : ATR multiplier (for example 3)
    * [wicks] : Whether to take wicks into account or not (default is false)

    Output:
    * SuperTrend line values

    **NOTE**: The command does not handle any plotting nor does it produce any signals!

    Example of usage:

    local c = ClosePrices()
    local macd = MACD(c, 12, 26, 9)
    local macdLine = macd[1]
    local st = CC_SuperTrendExt(macdLine, macdLine, macdLine, 22, 3)
    
    -- Plot macd
    Plot(1, 'MACD', macdLine)
    
    local upperId = Load('uid', NewGuid())
    local lowerId = Load('lid', NewGuid())
    
    if st < macdLine then
        upperId = NewGuid() -- reset upper id
        Plot(1, 'Long Stop', st, {c=Green, id=lowerId})
        -- DoBuy()
    else
        lowerId = NewGuid() -- reset lower id
        Plot(1, 'Short Stop', st, {c=Red, id=upperId})
        -- DoSell()
    end
    
    Save('uid', upperId)
    Save('lid', lowerId)
    • This topic was modified 1 year, 9 months ago by pshai. Reason: [UPDATE] Added warmup system
    • This topic was modified 1 year, 3 months ago by pshai. Reason: Fixed HL
    HaasScript Code
    Sign in or Register to download for free
    • #2210
      BBRNFX
      Basic
      Up
      0
      Down
      ::

      hi, i need the steps on How to install. Thanks a bunch

      • #2625
        pshai
        Admin
        Up
        1
        Down
        ::

        Simply create a new script, select its type as “COMMAND”, and then copy-paste the script from the lower codebox on this page. The upper codebox inside the description is just an example for how to use this command once it is properly installed.

    • #2792
      Up
      1
      Down
      ::

      Thank you!

Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free