Jtc.Optimization.LeanOptimizer.Example/ParameterizedSharedAppDomainAlgorithm.py
def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.'''

        # wait for our indicators to ready
        if not self.fast.IsReady or not self.slow.IsReady:
            return

        fast = self.fast.Current.Value
        slow = self.slow.Current.Value
        #self.Log("fast:" + str(fast) + "slow:" + str(slow)+ "take:" + str(self.take))
        if fast > slow * 1.001:
            self.SetHoldings("SPY", 1)
        elif self.Portfolio.HoldStock and self.Portfolio["SPY"].UnrealizedProfitPercent > self.take:
            self.Liquidate("SPY")
OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
OnData event is the primary entry point for your algorithm . Each new data point will be pumped in here .
def OnData(self, data):
        if not self.fast.IsReady or not self.slow.IsReady:
            return
        fast = self.fast.Current.Value
        slow = self.slow.Current.Value
        if fast > slow * 1.001:
            self.SetHoldings("SPY", 1)
        elif self.Portfolio.HoldStock and self.Portfolio["SPY"].UnrealizedProfitPercent > self.take:
            self.Liquidate("SPY")
def OnData ( self , data ) : if not self . fast . IsReady or not self . slow . IsReady : return fast = self . fast . Current . Value slow = self . slow . Current . Value if fast > slow * 1.001 : self . SetHoldings ( "SPY" , 1 ) elif self . Portfolio . HoldStock and self . Portfolio [ "SPY" ] . UnrealizedProfitPercent > self . take : self . Liquidate ( "SPY" )
OnData event is the primary entry point for your algorithm.
OnData event is the primary entry point for your algorithm .
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.''' # wait for our indicators to ready #self.Log("fast:" + str(fast) + "slow:" + str(slow)+ "take:" + str(self.take))
self
data