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/

    Trailing stop fired by High and Low instead of Close price

    General Code/Help
    2
    2
    63
    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.
    • fede3u
      fede3u last edited by

      How can I modify the logic of the bt.Order.StopTrail.

      When going long I d like to adapt trail going up on high candle price and generate sale on low candle price instead of using the close price and vice versa when going short.

      Thank you

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

        Don't take me for rude, but you say "trailing stop fired ...." and I could also say "trailing stop not fired ...".

        There is no indication as to what you are doing, what's happening, if that is actually the right behavior.

        Even if what you say would make some sense ... the following is completely wrong:

        @fede3u said in Trailing stop fired by High and Low instead of Close price:

        How can I modify the logic of the bt.Order.StopTrail.

        You can also go and try to modify how the markets work. It may be easier and it will probably fit what you have backtested with something you have modified to fit your wishes and not to try to model how things work in the reality.

        If StopTrail doesn't do what you expect, these are the possible reasons:

        • You don't know how such an order works in real markets

        • You do, but it's not the order type which fits what you try to model, but you have still chosen to do it.

        Imho: very wrong way to approach your backtesting.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
        $(document).ready(function () { app.coldLoad(); }); }