| Overall Statistics |
|
Total Trades 4 Average Win 0% Average Loss -56.44% Compounding Annual Return -96.995% Drawdown 87.700% Expectancy -1 Net Profit -86.936% Sharpe Ratio -0.661 Probabilistic Sharpe Ratio 1.346% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.408 Beta 3.646 Annual Standard Deviation 1.21 Annual Variance 1.465 Information Ratio -0.63 Tracking Error 1.098 Treynor Ratio -0.219 Total Fees $5.55 Estimated Strategy Capacity $170000000.00 Lowest Capacity Asset NQ XZDYPWUWC7I9 |
# region imports
from AlgorithmImports import *
# endregion
class AlertFluorescentPinkGorilla(QCAlgorithm):
def Initialize(self):
# Set Start Date
self.SetStartDate(2022, 1, 7)
# Set Strategy Cash
self.SetCash(100000)
# Slow EMA period
self.slow_ema_period = 10
# Add index
self.NDX = self.AddIndex("NDX", Resolution.Minute).Symbol
# Create 5-minute consolidator
five_min_cons = TradeBarConsolidator(timedelta(minutes = 15))
# Assign FiveMinuteHandler as the receiver of consolidated bars for our consolidator object
five_min_cons.DataConsolidated += self.FiveMinuteHandler
# Subscribe consolidator object to be automatically updated with minute bars
self.SubscriptionManager.AddConsolidator(self.NDX, five_min_cons)
# 10-EMA
self.ten_ema = ExponentialMovingAverage(self.slow_ema_period)
# Register indicator
self.RegisterIndicator(self.NDX, self.ten_ema, five_min_cons)
# Requesting data
NQ_future = self.AddFuture(Futures.Indices.NASDAQ100EMini)
# Set filter
NQ_future.SetFilter(0, 90)
# NQ future symbol
self.NQ_future_symbol = NQ_future.Symbol
# Data
self.data_storage = 0
# Warmup period
self.SetWarmUp(timedelta(days = 10))
def OnData(self, data: Slice):
# If not warming up
if not self.IsWarmingUp:
# Data
self.data_storage = data
def FiveMinuteHandler(self, sender, bar):
# If not warmup
if not self.IsWarmingUp:
# If not invested
if not self.Portfolio.Invested:
# If close above EMA
if self.Securities[self.NDX].Close > self.ten_ema.Current.Value:
# Loop future chain
for kvp in self.data_storage.FutureChains:
# Symbol
symbol = kvp.Key
# If symbol is NQ future
if symbol == self.NQ_future_symbol:
# Chain
chain = kvp.Value
# Loop chain
for contract in chain:
# Market order
self.MarketOrder(contract.Symbol, 1, tag = "Entering long")
# Break
break