MCPcopy Create free account
hub / github.com/kernc/backtesting.py / set_trailing_sl

Method set_trailing_sl

backtesting/lib.py:476–481  ·  view source on GitHub ↗

Set the future trailing stop-loss as some multiple (`n_atr`) average true bar ranges away from the current price.

(self, n_atr: float = 6)

Source from the content-addressed store, hash-verified

474 self.__atr = atr
475
476 def set_trailing_sl(self, n_atr: float = 6):
477 """
478 Set the future trailing stop-loss as some multiple (`n_atr`)
479 average true bar ranges away from the current price.
480 """
481 self.__n_atr = n_atr
482
483 def set_trailing_pct(self, pct: float = .05):
484 """

Callers 3

set_trailing_pctMethod · 0.95
initMethod · 0.80
initMethod · 0.80

Calls

no outgoing calls

Tested by 1

initMethod · 0.64