Hello, thanks to all who can help.I am trying to create a HFT-like algorithm in my spare time.I tried to acess the previous tick price using 

-data['IBM'][-1].LastPrice
but that threw a error:

-'SPY' wasn't found in the Slice object, likely because there was no-data at this moment in time and it wasn't possible to fillforward historical data. Please check the data exists before accessing it with data.ContainsKey("SPY")

any ideas?

thanks for the help! 

heres th code:

#   
#
#          
#
import clr
clr.AddReference("System")
clr.AddReference("QuantConnect.Algorithm")
clr.AddReference("QuantConnect.Indicators")
clr.AddReference("QuantConnect.Common")

from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Indicators import *

class MyAlgo(QCAlgorithm):

   def Initialize(self):
        '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
   
        self.SetStartDate(2019, 12, 27)    #Set Start Date
       # self.SetEndDate(2019, 7, )      #Set End Date
        self.SetCash(200)             #Set Strategy Cash
        self.equity = 'SPY'
        self.AddEquity(self.equity, Resolution.Tick)
        self.Securities[self.equity].FeeModel = ConstantFeeModel(.00)
        
   def OnData(self, data):
        openOrders = self.Transactions.GetOpenOrders()
        qty = self.Portfolio[self.equity].Quantity
        last = self.History(self.equity, 1, Resolution.Tick)
        price = self.Securities[self.equity].Price
        data.ContainsKey(self.equity)
        if self.Portfolio[self.equity].Quantity == 0 and len(openOrders) == 0 and data["SPY"][-1].LastPrice > self.Securities[self.equity].Price:
           
            
           self.LimitOrder(self.equity, 1, (self.Securities[self.equity].Price -.01))
          
          
       
            
        if self.Portfolio[self.equity].Quantity > 0:
           self.LimitOrder(self.equity, -qty, (self.Securities[self.equity].Price ))  
            
      
    
    
    
    
    #####
    
    #####