-
SuperTrend indicator.
Command uses ClosePrices, HLPrices and High/LowPrices built-in, so no price data cannot be inputted.
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 st = CC_SuperTrend(22, 3) local upperId = Load('uid', NewGuid()) local lowerId = Load('lid', NewGuid()) if st < c then upperId = NewGuid() -- reset upper id Plot(0, 'Long Stop', st, {c=Green, id=lowerId}) -- DoBuy() else lowerId = NewGuid() -- reset lower id Plot(0, 'Short Stop', st, {c=Red, id=upperId}) -- DoSell() end Save('uid', upperId) Save('lid', lowerId)