CC_RSIROCCMO (Simple HaasBot RSI+ROC+CMO) Indicator v2

0 159 Views No Comments 8 months ago
  • CC_Indicator from Simple RSI+ROC+CMO Bot v2
    Cleaned up Input Menu

    HaasScript Code
    -- Define command
    DefineCommand('RSIROCCMO', 'HaasBot RSI+ROC+CMO OSCILLATOR')
    -- Original Simple HaasBot indivator.
    -- 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.', true, 'RSIROCCMO', 'Text')
    local interval = DefineParameter(NumberType, 'interval', 'Used interval for price data. Default is 0 and the main interval will be used.', true, 0, 'Number,InputInterval')
    -- This will improve our backtest speed when using the command.
    DefineIntervalOptimization(interval)
    -- Input fields for the indicator.
    InputGroupHeader(''..name..' Settings')
     -- Inputfields
    local rsilength = Input('RSI Length',23, {group = "RSI+ROC+CMO Settings"})
    local roclength = Input('ROC Length',3, {group = "RSI+ROC+CMO Settings"})
    local cmolength = Input('CMO Length',15, {group = "RSI+ROC+CMO Settings"})
    local sellline = Input('_Sell Threshold', 90, {group = "RSI+ROC+CMO Settings"})
    local buyline = Input('_Buy Threshold', 20, {group = "RSI+ROC+CMO Settings"})
    -- Get information
    local prices = ClosePrices()
    -- Calculation
    local rsi = RSI(prices,rsilength)
    local roc = ROC(prices,roclength)
    local cmo = CMO(prices,cmolength)
    local ROCRSICMO = rsi[1] + roc[1] + cmo[1] / 3
    -- Plotting the lines
    Plot(1, 'RSIROCCMO', ROCRSICMO, Yellow)
    PlotBuySellZone(1, buyline, sellline)
    ChartSetAxisOptions(1, RightAxis, 0, 100)
    
    -- Determine the signal.
    local signal = GetBuySellLevelSignal(ROCRSICMO, buyline, sellline)
    
    -- Plot the indicator Use the chartIndex parameter.
    --PlotLineBuySellZone(chartIndex, 'RSIROCCMO', ROCRSICMO, buyline, sellline)
    
    --Return the custom signal.
    DefineOutput(EnumType, signal, 'Signal result', 'TradeBotContainer, IndicatorContainer, Signal Helpers')
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free