File tree 2 files changed +4
-0
lines changed
2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -451,6 +451,7 @@ def next(self):
451
451
trade .sl = min (trade .sl or np .inf ,
452
452
self .data .Close [index ] + self .__atr [index ] * self .__n_atr )
453
453
454
+
454
455
class PercentageTrailingStrategy (Strategy ):
455
456
"""
456
457
A strategy with automatic trailing stop-loss, trailing the current
@@ -464,6 +465,7 @@ class PercentageTrailingStrategy(Strategy):
464
465
overridden methods.
465
466
"""
466
467
_sl_percent = 5.
468
+
467
469
def init (self ):
468
470
super ().init ()
469
471
@@ -486,6 +488,7 @@ def next(self):
486
488
trade .sl = min (trade .sl or np .inf ,
487
489
self .data .Close [index ]* (1 + (self ._sl_percent / 100 )))
488
490
491
+
489
492
# Prevent pdoc3 documenting __init__ signature of Strategy subclasses
490
493
for cls in list (globals ().values ()):
491
494
if isinstance (cls , type ) and issubclass (cls , Strategy ):
Original file line number Diff line number Diff line change @@ -878,6 +878,7 @@ def next(self):
878
878
stats = Backtest (GOOG , S ).run ()
879
879
self .assertEqual (stats ['# Trades' ], 91 )
880
880
881
+
881
882
class TestUtil (TestCase ):
882
883
def test_as_str (self ):
883
884
def func ():
You can’t perform that action at this time.
0 commit comments