Help with RSI Divergence command implementation

alpha
By DMcL in Trading Bots Published September 2022 👁 932 views 💬 0 comments

Description

Hi there Im new to scripting and trying to implement the RSI Divergence command that i found here on Hassscripts I saved the RSI Divergence as a command script and then I could call it in a new script, below.... It plots on the chart, but when i try to use values of the RSI Div to enter a position it throws this error: 01 Oct 22, 15:44:59 ERROR: attempt to compare userdata with number at [7:0-17] Any help greatly appreciated
HaasScript
close = ClosePrices()


rsi = RSI(close, 14)
RDiv = CC_RSI_Divergence_smart(1)

if RDiv < 30 then
    DoLong()
end

if RDiv > 66 then
    DoShort()
end

-- if GetPositionDirection() == PositionLong then
--     if RDiv > 65  or StopLoss(2.6) then
--         DoExitPosition()
--     end
-- end

-- if GetPositionDirection() == PositionShort then
--     if RDiv < 31  or StopLoss(2.6) then
--         DoExitPosition()
--     end
-- end

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!