Every time I try to compile the code, I get the error:
I checked the micosoftC# codebasehttps://msdn.microsoft.com/en-us/library/system.windows.forms.control.onmousemove(v=vs.110) .aspx and made sure to add
using System.Windows.Forms;
If anyone has the time to check this, here is the code:
#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.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; using System.Windows.Forms; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class AAmousestuff : Indicator { private ChartAnchor lastMouseMoveAnchor = new ChartAnchor(); private ChartAnchor MyAnchor; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "AAmousestuff"; Calculate = Calculate.OnEachTick; 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; } else if (State == State.Configure) { } /*else if (State == State.DataLoaded) { if (this.ChartPanel != null) { this.ChartPanel.MouseMove += new MouseEventHandler(OnMouseMove); } }*/ } protected override void OnBarUpdate() { //Add your custom indicator logic here. } public override void OnMouseMove(ChartControl chartControl, ChartPanel chartPanel, ChartScale chartScale, ChartAnchor dataPoint) { // add any logic for when the mouse is moved here if (DrawingState == DrawingState.Moving) { //move the chart anchor when the drawing tool is in a moving state MyAnchor.MoveAnchor(lastMouseMoveAnchor, dataPoint, chartControl, chartPanel, chartScale, this); // dont forget to update delta point to last used! dataPoint.CopyDataValues(lastMouseMoveAnchor); } } } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private AAmousestuff[] cacheAAmousestuff; public AAmousestuff AAmousestuff() { return AAmousestuff(Input); } public AAmousestuff AAmousestuff(ISeries<double> input) { if (cacheAAmousestuff != null) for (int idx = 0; idx < cacheAAmousestuff.Length; idx++) if (cacheAAmousestuff[idx] != null && cacheAAmousestuff[idx].EqualsInput(input)) return cacheAAmousestuff[idx]; return CacheIndicator<AAmousestuff>(new AAmousestuff(), input, ref cacheAAmousestuff); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators.AAmousestuff AAmousestuff() { return indicator.AAmousestuff(Input); } public Indicators.AAmousestuff AAmousestuff(ISeries<double> input ) { return indicator.AAmousestuff(input); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators.AAmousestuff AAmousestuff() { return indicator.AAmousestuff(Input); } public Indicators.AAmousestuff AAmousestuff(ISeries<double> input ) { return indicator.AAmousestuff(input); } } } #endregion
This is the code in its entirety, so you should be able to copy it over a pre-gen indicator
Comment