File tree 1 file changed +2
-3
lines changed
1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -1585,16 +1585,15 @@ def geometric_mean(returns):
1585
1585
s .loc ['Max. Drawdown Duration' ] = _round_timedelta (dd_dur .max ())
1586
1586
s .loc ['Avg. Drawdown Duration' ] = _round_timedelta (dd_dur .mean ())
1587
1587
s .loc ['# Trades' ] = n_trades = len (trades )
1588
- s .loc ['Win Rate [%]' ] = win_rate = np .nan if not n_trades else (pl > 0 ).sum () / n_trades * 100 # noqa: E501
1588
+ s .loc ['Win Rate [%]' ] = np .nan if not n_trades else (pl > 0 ).sum () / n_trades * 100 # noqa: E501
1589
1589
s .loc ['Best Trade [%]' ] = returns .max () * 100
1590
1590
s .loc ['Worst Trade [%]' ] = returns .min () * 100
1591
1591
mean_return = geometric_mean (returns )
1592
1592
s .loc ['Avg. Trade [%]' ] = mean_return * 100
1593
1593
s .loc ['Max. Trade Duration' ] = _round_timedelta (durations .max ())
1594
1594
s .loc ['Avg. Trade Duration' ] = _round_timedelta (durations .mean ())
1595
1595
s .loc ['Profit Factor' ] = returns [returns > 0 ].sum () / (abs (returns [returns < 0 ].sum ()) or np .nan ) # noqa: E501
1596
- s .loc ['Expectancy [%]' ] = ((returns [returns > 0 ].mean () * win_rate +
1597
- returns [returns < 0 ].mean () * (100 - win_rate )))
1596
+ s .loc ['Expectancy [%]' ] = returns .mean () * 100
1598
1597
s .loc ['SQN' ] = np .sqrt (n_trades ) * pl .mean () / (pl .std () or np .nan )
1599
1598
1600
1599
s .loc ['_strategy' ] = strategy
You can’t perform that action at this time.
0 commit comments