I have connected to live connectione and i have appilied to the chart different indicator see on image.
1.my sample indicator name customroc created by self the code is
#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class customroc : Indicator { protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @""; Name = "customroc"; Calculate = Calculate.OnBarClose; IsOverlay = false; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; Period = 14; Smooth = 3; AddPlot(Brushes.Green, "Abovezero"); AddPlot(Brushes.OrangeRed, "Belowzero"); AddLine(Brushes.Cornsilk, 1, "Zeroline"); } else if (State == State.Configure) { } } protected override void OnBarUpdate() { //Add your custom indicator logic here. if (CurrentBar < Period) return; double Abovezero = CurrentDayOHL().CurrentOpen[0]; double Belowzero = CurrentDayOHL().CurrentOpen[0]; // Abovezero.Set(ROC(Period)[0]); //Belowzero.Set(ROC(Period)[0]); } #region Properties [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="Period", Order=1, GroupName="Parameters")] public int Period { get; set; } [NinjaScriptProperty] [Range(1, int.MaxValue)] [Display(Name="Smooth", Order=2, GroupName="Parameters")] public int Smooth { get; set; } [Browsable(false)] [XmlIgnore] public Series<double> Abovezero { get { return Values[0]; } } [Browsable(false)] [XmlIgnore] public Series<double> Belowzero { get { return Values[1]; } } #endregion } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private customroc[] cachecustomroc; public customroc customroc(int period, int smooth) { return customroc(Input, period, smooth); } public customroc customroc(ISeries<double> input, int period, int smooth) { if (cachecustomroc != null) for (int idx = 0; idx < cachecustomroc.Length; idx++) if (cachecustomroc[idx] != null && cachecustomroc[idx].Period == period && cachecustomroc[idx].Smooth == smooth && cachecustomroc[idx].EqualsInput(input)) return cachecustomroc[idx]; return CacheIndicator<customroc>(new customroc(){ Period = period, Smooth = smooth }, input, ref cachecustomroc); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators.customroc customroc(int period, int smooth) { return indicator.customroc(Input, period, smooth); } public Indicators.customroc customroc(ISeries<double> input , int period, int smooth) { return indicator.customroc(input, period, smooth); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators.customroc customroc(int period, int smooth) { return indicator.customroc(Input, period, smooth); } public Indicators.customroc customroc(ISeries<double> input , int period, int smooth) { return indicator.customroc(input, period, smooth); } } } #endregion
2. price osilator sample indicator from the existing one i applied to chart its working.
3.i downloaded form forum and appiled to chart no error in this case but its not working .
Please can you see the image below and reply me.
Comment