backtesting.py ema strategy Backtest.optimize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n1=list(range(5, 20)) | |
n2=list(range(15, 30)) | |
stats = bt_ema.optimize(n1=n1, n2=n2, | |
maximize='Equity Final [$]', constraint=lambda p: p.n1 < p.n2) | |
print(stats) | |
Start 2015-01-01 00:00:00 | |
End 2020-07-30 00:00:00 | |
Duration 2037 days 00:00:00 | |
Exposure [%] 98.3309 | |
Equity Final [$] 102.75 | |
Equity Peak [$] 125.776 | |
Return [%] 10175 | |
Buy & Hold Return [%] 2969.48 | |
Max. Drawdown [%] -46.1918 | |
Avg. Drawdown [%] -10.5397 | |
Max. Drawdown Duration 260 days 00:00:00 | |
Avg. Drawdown Duration 32 days 00:00:00 | |
# Trades 92 | |
Win Rate [%] 35.8696 | |
Best Trade [%] 253.563 | |
Worst Trade [%] -14.4748 | |
Avg. Trade [%] 8.04839 | |
Max. Trade Duration 116 days 00:00:00 | |
Avg. Trade Duration 22 days 00:00:00 | |
Expectancy [%] 14.6598 | |
SQN 1.34727 | |
Sharpe Ratio 0.235095 | |
Sortino Ratio 2.36271 | |
Calmar Ratio 0.174238 | |
_strategy EmaCrossStrategy(n1=6,n2=16) | |
dtype: object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment