-
Hey fellas!
This CC is based on the example I shared here: https://www.haasscripts.com/t/example-position-sizing-based-on-pre-determined-acceptable-loss-stop-loss-size/
Usage:
local acceptable_loss = 100 -- USDT local entry_price = CurrentPrice().ask -- we buy the ask price local stop_loss_price = SubPerc(entry_price) local trade_amount = CC_GetDynamicTradeAmount(acceptable_loss, entry_price, stop_loss_price) local margin_amount = CC_GetDynamicTradeAmount(acceptable_loss, entry_price, stop_loss_price, 'margin') local notional_amount = CC_GetDynamicTradeAmount(acceptable_loss, entry_price, stop_loss_price, 'notional')