@Sajil-Thamban I'm guessing when the crossover happens closer to the end of a bar, it will be treated as happening in the next bar. Because I observed similar behavior for my testing. I have the exact same strategy tested in backtrader and Tradingview. For some trades, the enter and exit (crossovers) occur at the same bar but for some trades, the crossovers will occur one bar earlier or later, even visually I saw the crossover as happening at the same bar on both platforms. The situation will become even worse when both MA lines overlapping each other during a tight range. Just my 2 cents worth of opinion.
You will need to go to the pyfolio files and make certain changes. At this point I am not sure whether I should go to pyfolio github repository and do a pull request because my changes work for what I need in the context of backtrader. I am in no way certain that making these changes will not break something else in pyfolio.
In round_trips.py, I made the following changes
Essentially, you now cannot pass rename logic in the dicts themselves. This also means that for you will need to create a list of the column names and pass it yourself.
this is the updated code Main changes are that we are creating a list of column names col_list before each function call to pass to the agg_all_long_short function (for reasons explained above - pandas deprecating nested renaming)
Also IB Gateway version 978 seems stable and reconnects seemingly better than the older versions like 972. It also has a "log in once a week" feature, that works. If you're on foreign IB site like Canada's 972 is all it offers. Download 978 (the most recent version) from the US site.