-
Creates a spread of prices based on Keltner channels.
Custom Command Dependencies:
Firetron’s XTRTest Code:
local LogList = function (list) local text = '' for i = 1, #list do if i ~= 1 then text = text..', ' end text = text..list[i] end Log(text) end local PlotOne = function (value, color, id, name) local lineOptions = LineOptions( color, -- color Smooth, -- style Solid, -- deco 1, -- width 0, -- offset RightAxis, -- side id, -- id true, -- behind false -- ignoreOnAxis ) Plot(0, name, value, lineOptions) end local PlotAll = function (list, color, id, name) for i = 1, #list do PlotOne(list[i], color, id..i, name..i) end end local Execute = function () local omni = false local maType = EmaType local maPeriod = 20 local trType = 'average' local trPeriod = 50 local multiplierList = {2, 3, 4, 5} local interval = 60 local fullCandles = true local market = PriceMarket() local hlcStyle = false local index = 1 local total = 1 local isPercent = false Log(' ') local spread = CC_GetKeltnerSpread(omni, maType, maPeriod, trType, trPeriod, multiplierList, interval, fullCandles, market, hlcStyle, index, total, isPercent) LogList(spread.lowerList) Log('Lower Spread:') Log(' ') Log(spread.middle) Log('Middle:') Log(' ') LogList(spread.upperList) Log('Upper Spread:') Log(' ') PlotAll(spread.upperList, Red, 'upper', 'Upper ') PlotOne(spread.middle, Yellow, 'middle', 'Middle') PlotAll(spread.lowerList, Green, 'lower', 'Lower ') end OptimizedForInterval(60, Execute)