Created with Highcharts 12.1.2Equity201020112012201320142015201620172018201920202021202220232024202520260500k1,000k-40-2000120120250M500M0100M200M49.849.8549.9
Overall Statistics
Total Orders
527
Average Win
4.57%
Average Loss
-1.96%
Compounding Annual Return
11.230%
Drawdown
25.300%
Expectancy
0.357
Start Equity
100000
End Equity
499547.49
Net Profit
399.547%
Sharpe Ratio
0.539
Sortino Ratio
0.613
Probabilistic Sharpe Ratio
5.223%
Loss Rate
59%
Win Rate
41%
Profit-Loss Ratio
2.34
Alpha
0.002
Beta
0.746
Annual Standard Deviation
0.125
Annual Variance
0.016
Information Ratio
-0.266
Tracking Error
0.076
Treynor Ratio
0.09
Total Fees
$2481.56
Estimated Strategy Capacity
$90000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
Portfolio Turnover
9.53%
# region imports
from AlgorithmImports import *
# endregion

class TrailingStopSPYAlgorithm(QCAlgorithm):
    def initialize(self):
        self.set_start_date(2010, 1, 1)

        # Add SPY to universe.
        self.add_equity("SPY", Resolution.MINUTE)
        # Constant Buy signal for SPY.
        self.add_alpha(ConstantAlphaModel(InsightType.PRICE, InsightDirection.UP, timedelta(1)))
        # PCM to re-enter the market daily.
        self.set_portfolio_construction(EqualWeightingPortfolioConstructionModel())
        # 3% Trailing Stop Loss
        self.add_risk_management(TrailingStopRiskManagementModel(0.03))