I would like to expose some non-plot values such as the Signal, the structure Stops & Targets...
I have some challenges so, I put together a simple example to demo the issue that creates two simple MA cross signals as an example. Attached is a zip with two basic indicators: the one that create the signals (2 types) and draw them as vertical lines (in 2 different patterns), and another indicator that reads the two signals <int> series and plot the value (-1/1 and -2/2).
There are 2 issues:
- Strategy builder only see the <double> output series, but not the <int> output series that the BWATT indicator creates
- The BWATTTest indicator only manage to read the second <int> output series, but ignore the first
protected override void OnBarUpdate() { if (saveCurrentBar != CurrentBar) // only once per bar { saveCurrentBar = CurrentBar; signal = 0; signalTrend[0] = 0; signalBreak[0] = 0; stop1[0] = 0; target1[0] = 0; stop2[0] = 0; target2[0] = 0; } if (CrossAbove(smaFast, smaSlow, 1)) { signal=1; signalTrend[0]=signal; Draw.VerticalLine(this,"Signal-"+CurrentBar+"-L1",0,Brushes.Green); } else if (CrossBelow(smaFast, smaSlow, 1)) { signal=-1; signalTrend[0]=signal; Draw.VerticalLine(this,"Signal-"+CurrentBar+"-S1",0,Brushes.Red); } else if (CrossAbove(smaFast, smaSlow, 5)) { signal=2; signalTrend[0]=signal; Draw.VerticalLine(this,"Signal-"+CurrentBar+"-L2",0,Brushes.Green,DashStyleHelper.DashDotDot,1,t rue); } else if (CrossBelow(smaFast, smaSlow, 5)) { signal=-2; signalTrend[0]=signal; Draw.VerticalLine(this,"Signal-"+CurrentBar+"-S2",0,Brushes.Red,DashStyleHelper.DashDotDot,1,tru e); } } #region #### Properties #### [Range(1, int.MaxValue), NinjaScriptProperty] [Display(ResourceType = typeof(Custom.Resource), Name = "Fast", GroupName = "NinjaScriptStrategyParameters", Order = 0)] public int Fast { get; set; } [Range(1, int.MaxValue), NinjaScriptProperty] [Display(ResourceType = typeof(Custom.Resource), Name = "Slow", GroupName = "NinjaScriptStrategyParameters", Order = 1)] public int Slow { get; set; } [Browsable(false)] [XmlIgnore] public Series<int> SignalTrend { get { return signalTrend; } } [Browsable(false)] [XmlIgnore] public Series<int> SignalBreak { get { return signalBreak; } } [Browsable(false)] [XmlIgnore] public Series<double> Stop1 { get { return stop1; } } [Browsable(false)] [XmlIgnore] public Series<double> Target1 { get { return target1; } } [Browsable(false)] [XmlIgnore] public Series<double> Stop2 { get { return stop2; } } [Browsable(false)] [XmlIgnore] public Series<double> Target2 { get { return target2; } } #endregion
protected override void OnBarUpdate() { if (BarsInProgress != 0) return; if (CurrentBars[0] < 0) return; Values[0][0] = BWATT1.SignalTrend[0]; Values[1][0] = BWATT1.SignalBreak[0]; }
Comment