File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -1443,7 +1443,7 @@ def geometric_mean(returns):
1443
1443
s .loc ['Max. Trade Duration' ] = _round_timedelta (durations .max ())
1444
1444
s .loc ['Avg. Trade Duration' ] = _round_timedelta (durations .mean ())
1445
1445
s .loc ['Profit Factor' ] = returns [returns > 0 ].sum () / (abs (returns [returns < 0 ].sum ()) or np .nan ) # noqa: E501
1446
- s .loc ['Expectancy [%]' ] = ((returns [returns > 0 ].mean () * win_rate -
1446
+ s .loc ['Expectancy [%]' ] = ((returns [returns > 0 ].mean () * win_rate +
1447
1447
returns [returns < 0 ].mean () * (100 - win_rate )))
1448
1448
s .loc ['SQN' ] = np .sqrt (n_trades ) * pl .mean () / (pl .std () or np .nan )
1449
1449
Original file line number Diff line number Diff line change @@ -266,7 +266,7 @@ def test_compute_stats(self):
266
266
'End' : pd .Timestamp ('2013-03-01 00:00:00' ),
267
267
'Equity Final [$]' : 51959.94999999997 ,
268
268
'Equity Peak [$]' : 75787.44 ,
269
- 'Expectancy [%]' : 8.791710931051735 ,
269
+ 'Expectancy [%]' : 3.097629974370269 ,
270
270
'Exposure Time [%]' : 93.99441340782123 ,
271
271
'Max. Drawdown Duration' : pd .Timedelta ('584 days 00:00:00' ),
272
272
'Max. Drawdown [%]' : - 47.98012705007589 ,
You can’t perform that action at this time.
0 commit comments