[Snippet] Size Reduction Counter & Plot Size Exposure

stable
By smokyho in Miscellaneous Published January 2021 👁 1,011 views 💬 2 comments

Description

This simple snippet will help you when back testing your script/setting for SMM or any other bot that has size reduction setting. Now you will see how many times bot "oversized" which can determine better risk management setting. The size exposure is one of Kobalt's utilities. https://www.haasscripts.com/t/tonly-he-best-of-eyecandy-plotexposure/
HaasScript
-- put this BEFORE/ABOVE SMM core logic start (oneway/hedge logic)
     local SRCounter = Load('SRCounter', 0) 

-- this goes in the update management position within position size check for size reduction for BOTH one way and hedge
     sizeRed = 1
     Save('SRCounter', SRCounter + sizeRed)

-- this goes at the bottom AFTER SMM core logic (oneway/hedge logic)
     Log('Size Reduction: '..SRCounter..' times')
     CustomReport('Size Reduction', SRCounter..' times')

    local lineLong = IfElse(longAmount > 0, longAmount, 0)
    local lineShort = IfElse(shortAmount > 0, -shortAmount, 0)
    local lineL = Plot(2, 'Longs', lineLong, {c=Green, s=Step})
    local lineS = Plot(2, 'Shorts', lineShort, {c=Red, s=Step})
    ChartSetOptions(2, 'Exposure')

2 Comments

Sign in to leave a comment.

C
CryptoRusty over 5 years ago

You'll need to add these in the inputs
local longAmount = LongAmount()
local shortAmount = ShortAmount()

S
smokyho over 5 years ago

local longAmount = LongAmount()
local shortAmount = ShortAmount()

is already there in the original SMM

but if this is for non SMM then yes, need to add that.