Overall Statistics
Total Orders
1081
Average Win
0.84%
Average Loss
-1.40%
Compounding Annual Return
4.544%
Drawdown
27.600%
Expectancy
0.067
Start Equity
100000
End Equity
155979.52
Net Profit
55.980%
Sharpe Ratio
0.201
Sortino Ratio
0.149
Probabilistic Sharpe Ratio
0.768%
Loss Rate
33%
Win Rate
67%
Profit-Loss Ratio
0.60
Alpha
-0.02
Beta
0.526
Annual Standard Deviation
0.102
Annual Variance
0.01
Information Ratio
-0.579
Tracking Error
0.096
Treynor Ratio
0.039
Total Fees
$2753.72
Estimated Strategy Capacity
$36000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
Portfolio Turnover
29.27%
Drawdown Recovery
706
from AlgorithmImports import *
class ParameterizedAlgorithm(QCAlgorithm):
    def initialize(self):
        # Receive parameters from the Job
        ema_fast = self.get_parameter("ema_fast", 200)
        ema_slow = self.get_parameter("ema_slow", 100)
        # Swap
        if ema_slow > ema_fast:
            ema_fast, ema_slow = ema_slow, ema_fast

        self.set_start_date(2013,10,7)
        self.set_end_date(2023,10,8)        
        self._symbol = self.add_equity("SPY").symbol
        self.fast = self.ema(self._symbol, ema_fast)
        self.slow = self.ema(self._symbol, ema_slow)
        self.set_name(f'{ema_fast=},{ema_slow=}')
        self.on_end_of_algorithm()

    def on_data(self, data):
        if not self.fast.is_ready or not self.slow.is_ready:
            return
        fast = self.fast.current.value
        slow = self.slow.current.value
        if fast > slow * 1.001:
            self.set_holdings(self._symbol, 1)
        if fast < slow * 0.999:
            self.liquidate()

    def on_end_of_algorithm(self):
        self.set_runtime_statistic("Pending Tax", f'${int(-100)}')
        self.set_runtime_statistic("Total Interet", f'${int(-100)}')
        self.set_runtime_statistic("Total Tax", f'${int(-100)}')
# region imports
from AlgorithmImports import *
# endregion

def Add(x: float, y: float) -> float:
    return x + y