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/

    No orders filled

    General Code/Help
    trades
    2
    7
    910
    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.
    • B
      bishbashbosh last edited by

      I am using the BackBroker for backtesting, but I am seeing zero trades made, even though stop-limit entry orders the strategy is placing should have been hit.

      I see a few orders as rejected, but most not.

      Any recommendations for things to check e.g. is it possible to see the reason an order is rejected?

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

        @bishbashbosh said in No orders filled:

        Any recommendations for things to check e.g. is it possible to see the reason an order is rejected?

        It is really impossible to know why you don't get any matches (most probably you are exceeding your available cash) without some working code.

        1 Reply Last reply Reply Quote 1
        • B
          bishbashbosh last edited by bishbashbosh

          I created a notebook here that demonstrates the issue: https://github.com/moconnell/public-notebooks

          Orders placed, look like they should be getting hit, but... nada:

          0_1538823459238_438ce3c4-5c33-4df8-b20c-9656809e785f-image.png

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

            I don't know if your expectation is that someone does a completely code review of what you have posted in GitHub.

            When one believes there is an issue somewhere ... one creates a small working sample to understand what the issue is and where it is (be it in the platform or in your logic)

            In any case all your orders are obviously (as stated above) being rejected because you exceed your cash reserves, not that difficult to see:

            • Cash in the chart: 10,000

            From your own log

            Size: 16000
            Price: 1.2225000000000001
            Price Limit: 1.2226000000000001
            

            You multiply 16000 by 1.2225 and ...

            @bishbashbosh said in No orders filled:

            Orders placed, look like they should be getting hit, but... nada:

            For obvious reasons.

            1 Reply Last reply Reply Quote 1
            • B
              bishbashbosh last edited by

              Well, I thought that was a small sample! Thanks for taking a look :)

              So, I guess in this case my question would be how to integrate leverage into the backtest? For example, the chart is of EURUSD and an account balance of 10k a buy order of 16k would be completely reasonable on IB.

              B 1 Reply Last reply Reply Quote 0
              • B
                bishbashbosh @bishbashbosh last edited by

                and the answer is:

                cerebro.broker.setcommission(leverage=50)
                
                1 Reply Last reply Reply Quote 0
                • B
                  bishbashbosh last edited by

                  @backtrader cool framework btw - thanks!

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