Overall Statistics
Total Trades
2
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
$3.70
Estimated Strategy Capacity
$0
Lowest Capacity Asset
MNQ Y1VKEF59AV41
# region imports
from AlgorithmImports import *
# endregion

class FatGreenBull(QCAlgorithm):

    def Initialize(self):

        self.SetStartDate(2022,7,12)
        self.SetEndDate(2022,7,13)

        # 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.Log("Done initialization")

    def OnData(self, data: Slice):
        if self.Time.hour == 9 and self.Time.minute == 38 and not self.TicksEnabled:
            self.MarketOrder(self._continuousContract.Mapped, 1)
            self.EnableTicks()
        if self.Time.hour == 9 and self.Time.minute == 40 and self.TicksEnabled:
            self.DisableTicks()

    def EnableTicks(self):
        if not self.AllowTicks: return
        if not self.TicksEnabled:
            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):
        if self.TicksEnabled:
            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