pair trading backtester logic is wrong
Closed this issue · 1 comments
PercyARS commented
your PnL calculation for the exit scenario is wrong
elif abs(zscore[i]) < 0.5:
money += countS1*S1[i] - S2[i] * countS2
count = 0
not sure what you are resetting count
for since it was never used in the code. and why is countS2 making a negative impact to PnL? if you fix these two issues, the strategy is not profitable at all.
chandinijain commented
@PercyARS this is now fixed, thanks for pointing it out