Hi !

I am new in the community and happy to write my first message !

I am here to convert a backtest that i make on excel and i am going to have your help ;)

When i run the code below, it doesn't find the symbol ES to order. Could you help me.

Runtime Error: ' ' 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(" ") (Open Stacktrace)

I have probably missed something about the use of symbol or consolidation of data.

using System;
using System.Collections.Generic;
using QuantConnect.Data;
using QuantConnect.Data.Market;
using QuantConnect.Interfaces;
using QuantConnect.Orders;

namespace QuantConnect.Algorithm.CSharp
{
    public class TestAlgorithm : QCAlgorithm
    {
        public RollingWindow<decimal> Open;
        public RollingWindow<decimal> Close;
        public RollingWindow<decimal> High;
        public RollingWindow<decimal> Low;
        public RollingWindow<decimal> Volume;
        
        public override void Initialize()
        {
            SetStartDate(2019, 01, 08);
            SetEndDate(2019, 10, 10);
            SetCash(1000000);

            var future = AddFuture("ES", Resolution.Minute);
            future.SetFilter(TimeSpan.Zero, TimeSpan.FromMinutes(182));
            
            Open = new RollingWindow<decimal>(4);
            Low = new RollingWindow<decimal>(4);
            High = new RollingWindow<decimal>(4);
            Close = new RollingWindow<decimal>(4);
            Volume = new RollingWindow<decimal>(4);

        }

        public override void OnData(Slice data)
        {
            
        if (data.ContainsKey("ES"))
        
        Open.Add(data["ES"].Open);
        Low.Add(data["ES"].Low);
        High.Add(data["ES"].High);
        Close.Add(data["ES"].Close);
        Volume.Add(data["ES"].Volume);
        
        var CurrentClose = Close[0];
        var OneBarAgoClose = Close[1];
        var TwoBarAgoClose = Close[2];
        var ThreeBarAgoClose = Close[3];

        var CurrentOpen = Open[0];
        var OneBarAgoOpen = Open[1];
        var TwoBarAgoOpen = Open[2];
        var ThreeBarAgoOpen = Open[3];
        
        var CurrentHigh = High[0];
        var OneBarAgoHigh = High[1];
        var TwoBarAgoHigh = High[2];
        var ThreeBarAgoHigh = High[3];
        
        var CurrentLow = Low[0];
        var OneBarAgoLow = Low[1];
        var TwoBarAgoLow = Low[2];
        var ThreeBarAgoLow = Low[3];
        
        var CurrentVolume = Volume[0];
        var OneBarAgoVolume = Volume[1];
        var TwoBarAgoVolume = Volume[2];
        var ThreeBarAgoVolume = Volume[3];
        
        
        if (CurrentClose > OneBarAgoClose)
        {
        MarketOrder("ES", 1);
        
        }
        else
        {
        Liquidate();
        }
        }
    }
}