feeding sizer with stop loss value
-
Hi, I have my strategy that predicts an entry point for a trade, after it predicts a stop loss and a take profit to exit the trade, so far so good.
My issue appears on the sizing and leverage part.My goal is to, when I hit the stop loss I should lose 1% of my bank(can ignore commissions, slippage... , will deal with that later).
I was hoping I could take leverage and sizing to achieve this goal, but I cannot find a way to feed the custom sizer with data from my strategy.basically, my sizing and leverage are dependent on the stop loss, but I am having an issue sending my stop loss value to the costume sizer.
any suggestions on how to pass my stop loss and take profit values to the sizer?
Best Regards
-
@peixoto Not 100% sure of what you want to achieve (maybe the relevant part of your code would help to understand better) but have you considered to specify size=xxx in your orders, or tried to use setsizer (see https://www.backtrader.com/docu/sizers/sizers/) before each position ?