Author Topic: Z-score from EMA difference with Ratio Model  (Read 49 times)

svkuz

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Z-score from EMA difference with Ratio Model
« on: March 01, 2023, 05:53:01 am »
Hello!

Firtly, congratulate with all work done, it's really helpful.

I have done some own tests to do backtests, and I found that your z-score its different than mine, using this backtest as a reference: https://www.pairtradinglab.com/backtests/Y-33ItOP-XTOENSI

Details:

What could be wrong in my calculations of z-score to be near of yours?

I attached my dataframe exported to excel to compare.

Thank you again,
Best Regards.

admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
  • Karma: +13/-0
    • Pair Trading Lab
Re: Z-score from EMA difference with Ratio Model
« Reply #1 on: March 01, 2023, 04:12:33 pm »
Probably the unstable period of EMA. EMA is an infinite-response filter, so you have to set the unstable period to "cut" the history.
https://ta-lib.org/d_api/ta_setunstableperiod.html

svkuz

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Z-score from EMA difference with Ratio Model
« Reply #2 on: March 02, 2023, 05:19:09 pm »
Thank you for your answer.

I have tried this with 34 or 100 unstable period and it gives me the same z-score result.

Also, I tried changing compability and no way: https://github.com/TA-Lib/ta-lib/blob/main/src/ta_func/ta_EMA.c#L285

What else can be?

Thank you again,
Best Regards.

admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
  • Karma: +13/-0
    • Pair Trading Lab
Re: Z-score from EMA difference with Ratio Model
« Reply #3 on: March 03, 2023, 11:26:06 am »
You can take a look to PTL Trader implementation: https://github.com/quantverse/ptltrader