Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
# region imports from AlgorithmImports import * # endregion class FatGreenBull(QCAlgorithm): def Initialize(self): self.SetStartDate(2022,7,12) self.SetEndDate(2022,7,12) # Set this to False to force it to stay on minute resolution self.AllowTicks = True self.future = Futures.Indices.MicroNASDAQ100EMini self._continuousContract = self.AddFuture(self.future, Resolution.Minute, dataNormalizationMode=DataNormalizationMode.Raw, dataMappingMode=DataMappingMode.OpenInterest, contractDepthOffset=0) self.commod = self._continuousContract.Symbol self.TicksEnabled = False self.TriggerOrder = False self.TriggerMinuteResolution = False self.Log("Done initialization") self.wasNone = False def OnData(self, data: Slice): if self._continuousContract.Mapped is None: if not self.wasNone: self.Debug(f"{self.Time} - None") self.wasNone = True else: self.Debug(f"{self.Time} - Not None") if self.TriggerOrder and self._continuousContract.Mapped is not None: self.TriggerOrder = False self.MarketOrder(self._continuousContract.Mapped, 1) if self.TriggerMinuteResolution and self.TicksEnabled: self.TriggerMinuteResolution = False self.DisableTicks() if self.Time.hour == 9 and self.Time.minute == 37 and not self.TicksEnabled: # Enter tick resolution self.EnableTicks() # Do the market order on the next update self.TriggerOrder = True if self.Time.hour == 9 and self.Time.minute == 39 and self.TicksEnabled: # Exit tick resolution on the next update self.TriggerMinuteResolution = True def EnableTicks(self): if not self.AllowTicks: return self.RemoveSecurity(self.commod) self._continuousContract = self.AddFuture(self.future, Resolution.Tick, dataNormalizationMode=DataNormalizationMode.Raw, dataMappingMode=DataMappingMode.OpenInterest, contractDepthOffset=0) self.commod = self._continuousContract.Symbol self.TicksEnabled = True def DisableTicks(self): self.RemoveSecurity(self.commod) self._continuousContract = self.AddFuture(self.future, Resolution.Minute, dataNormalizationMode=DataNormalizationMode.Raw, dataMappingMode=DataMappingMode.OpenInterest, contractDepthOffset=0) self.commod = self._continuousContract.Symbol self.TicksEnabled = False