Getting the above error in my code, in the "if portfolio is not invested" line. any idea how i can solve it?

using System;
using System.Collections.Generic;
using System.Linq;
using QuantConnect.Data;
using QuantConnect.Data.Consolidators;
using QuantConnect.Data.Market;
using QuantConnect.Indicators;

namespace QuantConnect.Algorithm.CSharp
public class TachyonOptimizedChamber : QCAlgorithm
public RollingWindow<QuoteBar> Open;
public RollingWindow<QuoteBar> Close;
public RollingWindow<QuoteBar> High;
public RollingWindow<QuoteBar> Low;

public override void Initialize()
SetStartDate(2018, 12, 10); //Set Start Date
SetCash(100000); //Set Strategy Cash

var forex = AddForex("EURUSD", Resolution.Hour, Market.Oanda);
//var forex2 = AddForex("AUDUSD", Resolution.Hour, Market.Oanda);
//var forex3 = AddForex("NZDUSD", Resolution.Hour, Market.Oanda);

// AddEquity("SPY", Resolution.Minute);
Open = new RollingWindow<QuoteBar>(8);
Low = new RollingWindow<QuoteBar>(8);
High = new RollingWindow<QuoteBar>(8);
Close = new RollingWindow<QuoteBar>(8);


/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// Slice object keyed by symbol containing the stock data
public override void OnData(Slice data)

var OneBarAgoOpen = Open[1];
var TwoBarAgoOpen = Open[2];

//var currentTick = tickWindow[0].AskPrice;
//var lastTick = tickWindow[1].AskPrice;

if(!Portfolio.Invested && OneBarAgoOpen < TwoBarAgoOpen)

// if (!Portfolio.Invested)QuoteBar
// {
// SetHoldings(_spy, 1);
// Debug("Purchased Stock");