For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Backtrader vs TradingView Final Portfolio Result



  • Hello,
    usually, i'm using tradingview to backtesting my data, now i trying backtrader to replace tradingView.

    after some attempt, i tried to replicate the same Strategy ,the MAcrossover.

    I'm using TSLA Data CSV for the testing.

    The result is for the number of trades , entry & exit price is the same. ( In my case, it's 58 trades ).

    I'm testing futures , Long & Short

    But the Final Portfolio Result is Different.
    My Backtester config is
    -not using commision fee
    -bt.sizers.FixedReverser,stake=1

    My TradingView Config is
    -Order Size: 1 contracts

    Final Result:
    Backtester -> -194.60
    TradingView -> 226.92

    My question is: It's possible to get the same final result between this two platform ? or there is some difference in TradingView Calculation, floating point, or other aspect ?

    thanks.



  • some edit:
    Final Result:
    Backtester -> -194.60
    TradingView -> -226.92

    both is negative.



  • @Ignasius-Wahyudi there is something(maybe wrong) when you calculate the net value when it is a future when you have a position,but after you close the position,the results is same. so , it is not a big question.



  • @Ignasius-Wahyudi results should be the same if the same data and same algo used. 15% difference is quite a lot if duration of the backtest is a year or 2-3 years.



  • @tianjixuetu ahh, i see. gonna check the positions. thanks.

    @ab_trader i think so, since the number of trades is the same. gonna check it again.



  • okay, now i know whythe result is different.
    Net Profit is calculated based on last closed position only
    backtrader current portfolio include the PNL on open positions too.


Log in to reply
 

});