Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DefineCommand ('WaveTrend', 'WaveTrend')
- -- Define command parameters.
- local chartIndex = DefineParameter(NumberType, 'chartIndex', 'The index on which to chart', true, 1, 'Number')
- local name = DefineParameter(StringType, 'name', 'Unique name of the indicator.', false, '', 'Text')
- local interval = DefineParameter(NumberType, 'interval', 'Used interval for price data. Default is 0 and the main interval will be used.', false, 0, 'Number,InputInterval')
- local n1 = Input("Channel Length", 10)
- local n2 = Input("Average Length", 21)
- local obLevel1 = Input("Over Bought Level 1", 60)
- local obLevel2 = Input("Over Bought Level 2", 53)
- local osLevel1 = Input("Over Sold Level 1", -60)
- local osLevel2 = Input("Over Sold Level 2", -53)
- OptimizedForInterval(CurrentInterval(), function()
- local ap = HLCPrices()
- local esa = EMA(ap, n1)
- local d = EMA(Abs(ap - esa), n1)
- local ci = (ap - esa) / (0.015 * d)
- local tci = EMA(ci, n2)
- local wt1 = tci
- local wt2 = SMA(wt1,4)
- local color1 = SkyBlue
- local color2 = Blue
- local l1 = Plot(1, "WT1", wt1, color1)
- local l2 = Plot(1, "WT2", wt2, color2)
- PlotDoubleColor(l1, 0, color1)
- PlotDoubleColor(l2, 0, color2)
- local histo = Plot(1, "Histogram", wt1-wt2, Yellow)
- PlotHistogram(histo, Yellow, false)
- PlotHorizontalLine(1, "Zero", Gray, 0)
- PlotHorizontalLine(1, "OB1", Red, obLevel1)
- PlotHorizontalLine(1, "OS1", Green, osLevel1)
- PlotHorizontalLine(1, "OB2", Red, obLevel2)
- PlotHorizontalLine(1, "OS2", Green, osLevel2)
- end)
- -- Determine the signal.
- local signal = GetBuySellLevelSignal(n1, osLevel2, osLevel2)
- DefineOutput(EnumType, signal, 'Signal result', 'TradeBotContainer, IndicatorContainer, Signal Helpers')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement