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/

    Logging enter/close a long/short position in SignalStrategy

    General Code/Help
    2
    4
    440
    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.
    • C
      ciril.pl last edited by

      Hi,

      First of all, I am new to the community so apologies if I do not follow some rules I might not be aware of. I browsed through the topics and have not found a problem similar to mine. My case is a strategy built on bt.SignalStrategy where I have LONG, LONGEXIT, SHORT, SHORTEXIT signals. The precise strategy is of no importance. What troubles me if there is a way to overwrite the default notifications to log information when we enter/close a long/short position instead of the common buy/sell. So in other words providing more detailed information what is happening in the broker. Hope this makes sense.

      Would appreciate any help :)

      Cheers!

      B 1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators @ciril.pl last edited by

        @ciril-pl said in Logging enter/close a long/short position in SignalStrategy:

        Hope this makes sense.

        No it doesn't.

        @ciril-pl said in Logging enter/close a long/short position in SignalStrategy:

        What troubles me if there is a way to overwrite the default notifications to log information when we enter/close a long/short position instead of the common buy/sell

        In order for it to make sense you may want to elaborate on what you mean with this. There is no difference in the notifications and how they are delivered, whether you use signals or you don't.

        1 Reply Last reply Reply Quote 0
        • C
          ciril.pl last edited by

          In quickstart you show how to overwrite notifications so they log information such as BUY CREATE,
          BUY EXECUTED and you arrive at the direction by looking at order.isbuy(). I would like to create notifications such as LONG CREATED, LONG EXECUTED, LONG CLOSED and the equivalents for short positions based on the LONG, LONGEXIT, SHORT, SHORTEXIT signals embedded in bt.SignalStrategy.

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

            Those notifications as such don't exist. You can track the Trade instances you get notified via notify_trade which will contain that information

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