I am trying to Expose the List created in the code to other Indicators and Strategies. The code seems to work fine within the indicator and am in fact using it. After spending a few weeks I still have not figured out how to expose it. I am guessing that I need something in the Properties Region and have tried many ideas but no success.
#region Using declarations using System; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Data; using NinjaTrader.Gui.Chart; using System.Collections.Generic; #endregion // This namespace holds all indicators and is required. Do not change it. namespace NinjaTrader.Indicator { // Use Indicator Name as Prefix to Class Name public class htcSampleExposePublicList_SampleListClass { public int SampleInt; public double SampleDouble; public string SampleString; public bool SampleBool; public htcSampleExposePublicList_SampleListClass(int SampleInt, double SampleDouble, string SampleString, bool SampleBool ) { this.SampleInt = SampleInt; this.SampleDouble = SampleDouble; this.SampleString = SampleString; this.SampleBool = SampleBool; } } [Description("Learn how to Expose a Publis Class List")] public class htcSampleExposePublicList : Indicator { #region Variables // User defined variables (add any user defined variables below) public List<htcSampleExposePublicList_SampleListClass> samplelistclass = new List<htcSampleExposePublicList_SampleListClass>(); #endregion protected override void Initialize() { Overlay = false; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Criteria to Clear List if (Falling(SMA(20))) samplelistclass.Clear(); // Criteria to Add to List if (Rising(SMA(20))) samplelistclass.Add(new htcSampleExposePublicList_SampleListClass(0, SMA(10)[0], "SMA is Rising", true )); } #region Properties // What is the Code to Expose "samplelistclass" to other Indicators and Stratagies? #endregion } }
Comment