kernc/backtesting.py

SQN calculation not using expectancy?

Open

#558 aperta il 23 dic 2021

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Python (863 fork)batch import
help wanted

Metriche repository

Star
 (4387 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Hi,

It's good to see the stats include SQN. According to https://evilspeculator.com/tools-section/concepts/:

SQN = root(n) * expectancy / stdev(R)

but I suspect it's not correctly calculated:

https://github.com/kernc/backtesting.py/blob/77f4c46b82169c2689e1c4ad5994765556179eb2/backtesting/_stats.py#L139

as it's not using the result of expectancy:

https://github.com/kernc/backtesting.py/blob/77f4c46b82169c2689e1c4ad5994765556179eb2/backtesting/_stats.py#L138

Unless I am missing something?

Thanks!

Guida contributor