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 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 |
namespace QuantConnect.Algorithm.CSharp { public class ParticleMultidimensionalEngine : QCAlgorithm { private RenkoConsolidator renkoConsolidator; private FuturesContract frontmonthContract; public override void Initialize() { SetStartDate(2019, 9, 3); //Set Start Date SetEndDate(2019, 12, 3); SetCash(100000); //Set Strategy Cash // Subscribe to gold futures chain var gc = AddFuture(Futures.Metals.Gold); // Filter contracts to only front month contract gc.SetFilter(universe => universe.FrontMonth()); // Define the Renko consolidator renkoConsolidator = new RenkoConsolidator(10); // Set DataConsolidated event handler for the Renko Consolidator renkoConsolidator.DataConsolidated += (sender, bar) => { Debug($"Renko Bar Consolidated On {bar.EndTime} for {bar}"); }; } public override void OnData(Slice data) { foreach(var chain in data.FutureChains){ // Get trade bars for contracts in chain var tradebars = chain.Value.TradeBars; // Get front month contract var contract = chain.Value.FirstOrDefault(); // If front month contract has been delisted/updated if(frontmonthContract == null || (contract.Symbol != frontmonthContract.Symbol)){ frontmonthContract = contract; } // Get symbol for front month contract var symbol = frontmonthContract.Symbol; // Update Renko Consolidator with trade bar data if(tradebars.Keys.Contains(symbol)){ var tradebar = tradebars[symbol]; renkoConsolidator.Update(tradebar); } } } } }