Potentially very counter-intuitive trading strategy

stable
By pshai in Other Published March 2024 👁 1,156 views 💬 0 comments

Description

Hey folks! In search of dynamic and counter-intuitive (but smart) trading strategies, I happened to create this. It's a bi!@$ to finetune... But it looks good on the charts. :pepeshrug: Let me know if you want to see a full bot using this strategy! ~May the profits be with you~ Screenshots available here: https://discord.com/channels/269316665483722764/1221144888268296292/1221144888268296292
HaasScript
-- Potentially very counter-intuitive trading strategy
-- Author: pshai

ma_len = Input('MA Length', 13)
ma_type = InputMaTypes('MA Type', EmaType)
bb_len = Input('BB Length', 3)
bb_dev = Input('BB Deviation', 2)
bb_type = InputMaTypes('BB Type', EmaType)
bw_thres = Input('BBand Width Threshold %', 0.7) / 100
cci_len = Input('CCI Length', 50)
cci_br = Input('CCI Base Range', 100)
cci_ar = Input('CCI Dynamic Range', 50)
 

OptimizedForInterval(
    0,
    function()
        local h = HighPrices()
        local l = LowPrices()
        local c = ClosePrices()

        ma = MA(c, ma_len, ma_type)
        bb = BBANDS(c, bb_len, bb_dev, bb_dev, bb_type)
        bw = (bb.upper - bb.lower) / bb.middle
        cci = CCI(h, l, c, cci_len)

        cci_u = 100 + (50 * (bw / bw_thres - 1) * 2)
        cci_l = -cci_u

        Plot(0, 'ma', ma, Gray)

        Plot(1, 'bw', bw)
        PlotHorizontalLine(1, '1', Gray, bw_thres, Dashed)

        Plot(2, 'cci', cci)
        Plot(2, 'cci_u', cci_u, DarkGray)
        Plot(2, 'cci_l', cci_l, DarkGray)


        if bw > bw_thres then
            local above = c > ma
            local color, shape

            if cci > cci_u and above then
                -- short entry
                color = Red
                shape = ShapeTriangleDown
            elseif cci < cci_l and not above then
                -- long entry
                color = Green
                shape = ShapeTriangleUp
            end
            
            PlotShape(0, shape, color, 4, above) 
        end
    end
)

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!