Pair Trading Lab > Questions & Answers

Z-Score values shown in Trade-Log differ to calculated values

(1/3) > >>

Marc Wengenroth:
Dear pairtradinglab team,

I noticed that Z-Score values shown in the Trade-Log of the backtesting tool do not equal to the values I calculated before, even if my trades have been processed at the right date, in case of the example attached. But in most cases the tool trades at points when my Z-Score treshold definitely hasn´t been reached yet.

Z-Score values shown in the Trade-Log even exceed the maximum Z-Score values of my calculation, what makes me wonder. The values have been calculated exactly in the way described in your description of Ratio model and I verified that I definitely used the same data for the quotes as your tool does.

How is it possible that those values differ from mine?

I attached my calculation, the quotes and the backtesting results.

Kind regards,
Marc

admin:
Hi,

please post also the link to the concrete backtest made with PTL so I can compare...you can just paste the URL of the PTL backtest, it is persistent

Marc Wengenroth:
Here it is:

https://www.pairtradinglab.com/backtests/Wqb25kPHO3ZCYEf6

admin:
OK the first problem I see in your sheet is that you calculate the moving average and standard deviation using wrong data. For instance, for 15.5.2017 (row #164) you include the line #164 to both moving average and standard deviation calculation. This is wrong.

The last price point should be only used to determine the Z-score, but this sample cannot be included in the moving average / std dev calculation. You need to shift the floating window by one sample. So the correct period for row #164 is rows 165-194.

Then I see stock prices are a bit different, you use Yahoo, PTL uses Google Finance for non-US stocks.

BTW we tried to reimplement our Ratio model to Quantopian for reference, you can take a look for inspiration (but it is run using intraday prices):
https://www.quantopian.com/algorithms/557c0617c6591162f70004b2

Marc Wengenroth:
Hello and many thanks at first.

Well, I can see that I come closer to the Z-Score your tool calculated but there´s still too much difference.

I guess the Z-Score shown in the Trade-Log is based on calculation with daily close quotes, right? So this is not based on calculation with bid/ask price, right?

How can I get Google quotes?

Navigation

[0] Message Index

[#] Next page

Go to full version