Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    leverage doesn't affect returns in backtesting

    Indicators/Strategies/Analyzers
    3
    4
    1769
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dongiulio last edited by

      I'm a bit confused with the leverage,

      I ran my strategy twice, first time setting leverage 400, second time leverage 800, here's how I set the leverage:

      cerebro.broker.setcommission(commission=0.0, leverage=400)
      

      then pprinted the bt.analyzers.TradeAnalyzer with:

           print('TradeAnalyzer :')
           stats[0].analyzers.TradeAnalyzer.pprint()
      

      In both cases I get a bunch of stats about my analyzer, but what is strange is that the analysis I get is absolutely the same, numbers are an exact match for both leverages.

      Also my broker cash and broker value are the same.

      1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by ab_trader

        If you have same trade stats for both cases, than (as a guess) you didn't increase position size to use that increased leverage.

        • If my answer helped, hit reputation up arrow at lower right corner of the post.
        • Python Debugging With Pdb
        • New to python and bt - check this out
        B 1 Reply Last reply Reply Quote 1
        • B
          backtrader administrators @ab_trader last edited by

          @ab_trader said in leverage doesn't affect returns in backtesting:

          If you have same trade stats for both cases, than (as a guess) you didn't increase position size to use that increased leverage.

          Right.

          @dongiulio said in leverage doesn't affect returns in backtesting:

          I get is absolutely the same, numbers are an exact match for both leverages

          You are confusing leverage with multiplier(which is used for example with Futures).

          • leverage gives you more buying potential. But it is a potential and the decision as to how much of that potential to use is yours

          • multiplier: affects directly the returns. Unfortunately assets in real-life have a fixed multiplier and you cannot choose it.

          1 Reply Last reply Reply Quote 0
          • D
            dongiulio last edited by

            thanks, now it makes more sense.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors