The output of the below code:
[1][0] = System.Collections.Generic.List`1[System.Int32]
[2][0] = System.Collections.Generic.List`1[System.Int32]
[3][0] = System.Collections.Generic.List`1[System.Int32]
The code:
#region Using declarations using System.Collections.Generic; #endregion namespace NinjaTrader.Indicator { public class TEST2 : Indicator { #region Variables private bool FirstRun = true; private int i, j; private string sOutput; private List<List<int>> SubList = new List<List<int>>() ; private List<List<List<int>>> MDList = new List<List<List<int>>>(); #endregion protected override void OnBarUpdate() { if (FirstRun) { FirstRun = false; SubList.Add (new List<int>() {1, 2, 3, 4}); for (i = 0; i < 4; i++) { MDList.Add (new List<List<int>>(SubList)); } Print ("Initialized Output"); sOutput = ""; for (i = 0; i < MDList.Count; i++) { for (j = 0; j < MDList[i].Count; j++) { sOutput = sOutput + "[" + i + "]" + "[" + j + "] = " + MDList[i][j] + "\t"; } sOutput = sOutput + Environment.NewLine; } Print (sOutput); } } }
As always, thanks and regards
Shannon
Comment