Skip to content

Commit 1daebdb

Browse files
committed
Update index example code/output with renewed stats
1 parent 762259a commit 1daebdb

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

index.html

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,9 @@ <h3 id="example" class="title has-text-centered">
309309
n2 = 20
310310

311311
def init(self):
312-
self.sma1 = self.I(SMA, self.data.Close, self.n1)
313-
self.sma2 = self.I(SMA, self.data.Close, self.n2)
312+
close = self.data.Close
313+
self.sma1 = self.I(SMA, close, self.n1)
314+
self.sma2 = self.I(SMA, close, self.n2)
314315

315316
def next(self):
316317
if crossover(self.sma1, self.sma2):
@@ -319,8 +320,9 @@ <h3 id="example" class="title has-text-centered">
319320
self.sell()
320321

321322

322-
bt = Backtest(GOOG, SmaCross, cash=10000,
323-
commission=.002, exclusive_orders=True)
323+
bt = Backtest(GOOG, SmaCross,
324+
cash=10000, commission=.002,
325+
exclusive_orders=True)
324326

325327
output = bt.run()
326328
bt.plot()</code></pre>
@@ -335,7 +337,12 @@ <h3 id="example" class="title has-text-centered">
335337
Equity Final [$] 68935.12
336338
Equity Peak [$] 68991.22
337339
Return [%] 589.35
338-
Buy & Hold Return [%] 703.46
340+
Buy &amp; Hold Return [%] 703.46
341+
Return (Ann.) [%] 25.42
342+
Volatility (Ann.) [%] 38.43
343+
Sharpe Ratio 0.66
344+
Sortino Ratio 1.30
345+
Calmar Ratio 0.77
339346
Max. Drawdown [%] -33.08
340347
Avg. Drawdown [%] -5.58
341348
Max. Drawdown Duration 688 days 00:00:00
@@ -350,9 +357,6 @@ <h3 id="example" class="title has-text-centered">
350357
Profit Factor 2.13
351358
Expectancy [%] 6.91
352359
SQN 1.78
353-
Sharpe Ratio 0.18
354-
Sortino Ratio 0.44
355-
Calmar Ratio 0.06
356360
_strategy SmaCross(n1=10, n2=20)</samp></pre>
357361
</div>
358362
</div>

0 commit comments

Comments
 (0)