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/

    Best way to calculate maximum draw down in a specific open position

    General Code/Help
    3
    12
    2594
    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.
    • T
      Trade Prophet last edited by

      What is the best way to calculate the max. draw down for an open position?
      Say I have an open position,and it started to move against me , I would like to close at a certain loss (absolute of percentage wise), can anyone guide me as to how to do this in backtrader ?

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

        @trade-prophet just issue the stop order, and position will be closed at that level.

        • 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
        1 Reply Last reply Reply Quote 0
        • T
          Trade Prophet last edited by

          But I need to detect the stop has reached,
          or is there an internal mechanism for it in bt ?

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

            @trade-prophet backtrader will do it. Check out the https://www.backtrader.com/docu/order-creation-execution/order-creation-execution.html

            • 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
            1 Reply Last reply Reply Quote 0
            • T
              Trade Prophet last edited by

              I would like to exit on a specific loss from top , the link above explains entries only , not exists(buy stops not stop loss)

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

                @trade-prophet stop order is always the same order, doesn't matter if you open position or close. If you are in the long position, for example, you need to calculate price level lower than current price and issue stop order at this level As soon as price will cross the level from above, stop order will be executed.

                • 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
                1 Reply Last reply Reply Quote 1
                • T
                  Trade Prophet last edited by

                  Great,thank you !
                  So,as soon as the order is executed on notify_order - issue the reverse stop order ,right ?

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

                    @trade-prophet as soon as order executed position will be closed. Why it should issue reversed stop order?

                    • 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
                    1 Reply Last reply Reply Quote 0
                    • T
                      Trade Prophet last edited by

                      I meant as soon as the order is executed on notify_order - issue the close stop order(sell order in case of long orders)

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

                        @trade-prophet notify_order treats stop orders as any other order, it will be marked as executed with all related data as execution price etc established.

                        • 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
                        1 Reply Last reply Reply Quote 0
                        • B
                          backtrader administrators last edited by

                          On this topic, see the post made today

                          • https://www.backtrader.com/blog/posts/2018-02-01-stop-trading/stop-trading.html
                          1 Reply Last reply Reply Quote 0
                          • T
                            Trade Prophet last edited by

                            Thank you very much for all your help, much appreciated!

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