[pshaiCmd] SuperTrend Extended

0 902 Views 1 Comment 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, 1 month ago by pshai. Reason: [UPDATE] Added warmup system
    • This topic was modified 7 months ago by pshai. Reason: Fixed HL
    HaasScript Code
    Sign in or Register to view
    • #2210
      BBRNFX
      Basic
      Up
      0
      Down

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

Login or Register to Comment

Unlock your crypto trading potential

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

Join for Free