
-
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)