@bernardlin
I have something critical to point out.
Backtesting forex pairs trading has a major flaw. It uses a different way to calculate pnl of the backtest because the assets involved rarely have the same quote or base currencies.
The only exception to this is if the assets involved have the same base currency, e.g USDCHF USDJPY. If this pair appear to be cointegrated, then the returns of the backtest would be the same as calculating pnl of, say, GLD GDX.
But if the forex assets involved are of the same quote currency or of completely different currency bases and quotes, then the calculation of the pnl is completely different.
If one proceeds and backtest these cointegrated pairs the same way one do regularly then one would get the wrong result.
I am really keen to know how you went about backtesting cointegrated forex pairs and getting the correct result using Backtrader. I am yet to do that.