| Overall Statistics |
|
Total Trades 0 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.985 Tracking Error 0.572 Treynor Ratio 0 Total Fees $0.00 |
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using QuantConnect.Interfaces;
using System.Collections.Generic;
using QuantConnect.Data.Consolidators;
using QuantConnect.Data.Market;
using QuantConnect.Securities.Future;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Demonstration of how to initialize and use the RenkoConsolidator
/// </summary>
/// <meta name="tag" content="renko" />
/// <meta name="tag" content="indicators" />
/// <meta name="tag" content="using data" />
/// <meta name="tag" content="consolidating data" />
public class WeeklyAlgorithm : QCAlgorithm
{
private FuturesContract frontmonthContract;
private Future myFuture;
/// <summary>
/// Initializes the algorithm state.
/// </summary>
public override void Initialize()
{
SetTimeZone(NodaTime.DateTimeZone.Utc);
SetStartDate(2020, 03, 01);
SetEndDate(DateTime.Now.Date.AddDays(-1)); // Or use a relative date.
SetCash(1000000);
// Subscribe to futures chain
myFuture = AddFuture(Futures.Indices.SP500EMini, Resolution.Hour, Market.CME , false, 0m);
// Set Brokerage Model
SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin);
// Filter for front month contracts, ignore non-front month contracts
myFuture.SetFilter(universe => universe.FrontMonth());
Schedule.On(DateRules.WeekStart(myFuture.Symbol), TimeRules.At(0, 0), () =>
{
Debug($"WeekStart(myFuture.Symbol), TimeRules.At(0, 0) fired at: {myFuture.Symbol} {Time}");
});
Schedule.On(DateRules.WeekEnd(myFuture.Symbol), TimeRules.At(0, 0), () =>
{
Debug($"WeekEnd(myFuture.Symbol), TimeRules.At(0, 0) fired at: {myFuture.Symbol} {Time}");
});
Schedule.On(DateRules.WeekStart(myFuture.Symbol), TimeRules.AfterMarketOpen(myFuture.Symbol), () =>
{
Debug($"WeekStart(myFuture.Symbol), TimeRules.AfterMarketOpen(myFuture.Symbol) fired at: {myFuture.Symbol} {Time}");
});
Schedule.On(DateRules.WeekEnd(myFuture.Symbol), TimeRules.BeforeMarketClose(myFuture.Symbol), () =>
{
Debug($"WeekEnd(myFuture.Symbol), TimeRules.BeforeMarketClose(myFuture.Symbol) fired at: {myFuture.Symbol} {Time}");
});
}
public void OnData(TradeBars data)
{
}
public void OnData(Slice data)
{
}
}
}