Regarding FAQ: if Backtrader is not a bid-ask Platform - what is is then?



  • Hi,

    in the FAQ, I can find the following sentence:

    I want to trade using bid-ask prices

    Not a goal of this platform. You may still feed the prices to your own defined lines in the data feed and use them. See the documentation for extending data feeds.

    As I am quite new in trading:

    For what can I use it then? Only for Open-High-Low-Close (OHLC) related data?

    Thanks in advance!



  • Hi @NewestTrader
    Welcome to the community. You can use mid price data. This is basically the average of the bid and the ask prices. So yes, OHLC mid price data is fine.

    The drawback to this is that you cannot capture the cost of the spread in your PnL calculations out of the box.



  • The thing is that bid-ask is an pair of instantaneous values (tick) and OHLC is in most cases handled differently, because it is used in larger timeframes (1-minute) and therefore you have a 1-minute OHLC bar and the only meaningful bid-ask pair value is the last one.

    In any case people have apparently taking a path similar to this one (quickly googling to see if I could find the discussion didn't help) for backtesting bid/ask strategies

    • Load the bid price as a data feed (i.e.: data0)
    • Load the ask price as a different data feed (i.e.: data1)
    • Use the backtrader compensation feature to link operations of data0 and data1
    • Execute buy / sell operation independently on the bid/ask data feeds

    A link to the compensation feature doc: https://www.backtrader.com/docu/order-creation-execution/futurespot/future-vs-spot.html

    This of course is clearly not applicable for live trading, but will let you perform full backtesting capturing the spread.



  • thanks to both of you!


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.