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/

    custom sizer class

    General Code/Help
    3
    3
    582
    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.
    • S
      siavash last edited by siavash

      I am going to apply money management by coding custom sizer.How can I get first set cash in middle of back-testing?and also a variable defined in the outer function from inside of the sizer class?

      K 1 Reply Last reply Reply Quote 0
      • K
        kausality @siavash last edited by kausality

        @siavash

        1. From inside sizer class: self.broker.get_cash()

        2. You can call your custom function as you want like any other python function and make it return values as you wish.

        B 1 Reply Last reply Reply Quote 1
        • B
          backtrader administrators @kausality last edited by

          @kausality said in custom sizer class:

          1. You can call your custom function as you want like any other python function and make it return values as you wish.

          So, because ...

          @siavash said in custom sizer class:

          and also a variable defined in the outer function from inside of the sizer class?

          ... this is impossible.

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