Simple RSI+ROC+CMO HaasBot Indicator

stable
By Kobalt in Hybrid Published December 2019 👁 2,125 views 💬 0 comments

Description

Indicator from: Simple RSI+ROC+CMO HaasBot. Added some(tidy up+InputHeaders+chartindex) love.
HaasScript
-- Define command
DefineCommand('RSIROCCMO', ' Indicator from: Simple RSI+ROC+CMO HaasBot')

-- Define command parameters. the ins--
local chartIndex = DefineParameter(NumberType, 'chartIndex', 'The index on which to chart', true, 69, 'Number')
local name = DefineParameter(StringType, 'name', 'Unique name of the indicator.', false, 'RSI+ROC+CMO', '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')

-- This will improve our backtest speed when using the command.
DefineIntervalOptimization(interval)

-- Input fields for the indicator.
InputGroupHeader(''..name..' Settings')
local interval = InputInterval("   Interval", 0)
local sellline = Input('   Sell Threshold', 80)
local buyline = Input('  Buy Threshold', 20)
local rsilength = Input('  RSI Length',23)
local roclength = Input(' ROC Length',3)
local cmolength = Input('CMO Length',15)

-- Get data.
local prices = ClosePrices()

-- Calculation
local rsi = RSI(prices,rsilength)
local roc = ROC(prices,roclength)
local cmo = CMO(prices,cmolength)
local RSIROCCMO = rsi[1] + roc[1] + cmo[1] / 3

-- Plot the indicator (Use the chartIndex parameter)
Plot(chartIndex, ''..name..'', RSIROCCMO, Yellow)
PlotBuySellZone(chartIndex, buyline, sellline)
ChartSetAxisOptions(chartIndex, RightAxis, 0, 100)

-- Determine the signal.
local signal = GetBuySellLevelSignal(RSIROCCMO, buyline, sellline)

--Return the custom signal.the output(s)--
DefineOutput(EnumType, signal, 'Signal result', 'TradeBotContainer, IndicatorContainer, Signal Helpers')

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!