Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

CS0115 error code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    CS0115 error code

    I have "System.Windows.Input and System.Windows.Forms" in my Using Declaration. Every time I tried to compile the following codes, I get error code CS0115 (no suitable method to override).
    Please help resolving this issue. Thanks.

    public override void OnMouseDown(ChartControl chartControl, ChartPanel chartPanel, ChartScale chartScale, ChartAnchor dataPoint)
    {

    ''''''''''' my code '''''''''''
    }​

    #2
    Hello, thanks for writing in. We have an existing example of how to get a mouse down event through a chart here:


    Kind regards,

    -ChrisL​
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      I have "System.Windows.Input and System.Windows.Forms" in my Using Declaration. Every time I tried to compile the following codes, I get error code CS0115 (no suitable method to override).
      Please help resolving this issue. Thanks.

      public override void OnMouseDown(ChartControl chartControl, ChartPanel chartPanel, ChartScale chartScale, ChartAnchor dataPoint)
      {
      switch (DrawingState)
      {
      case DrawingState.Building:
      dataPoint.CopyDataValues(Anchor);
      Anchor.IsEditing = false;
      DrawingState = DrawingState.Normal;
      IsSelected = false;
      break;
      case DrawingState.Normal:
      // make sure they clicked near us. use GetCursor incase something has more than one point
      Point point = dataPoint.GetPoint(chartControl, chartPanel, chartScale);
      if (GetCursor(chartControl, chartPanel, chartScale, point) != null)
      DrawingState = DrawingState.Moving;
      else
      IsSelected = false;
      break;
      }
      }​

      Comment


        #4
        Hi realrich, thanks for the follow up. If you are working on a drawing tool, make sure the class that derives from DrawingTools is within this code exactly:

        Code:
        #region Using declarations
        using System;
        using System.Collections.Generic;
        using System.ComponentModel;
        using System.ComponentModel.DataAnnotations;
        using System.Linq;
        using System.Windows;
        using System.Windows.Media;
        using System.Xml.Serialization;
        using NinjaTrader.Gui;
        using NinjaTrader.Gui.Chart;
        #endregion
        ​
        
        namespace NinjaTrader.NinjaScript.DrawingTools
        {
        [B]    public class MyCustomDrawingTool : DrawingTool
                {
                    public override void OnMouseDown(ChartControl chartControl, ChartPanel chartPanel, ChartScale chartScale, ChartAnchor dataPoint){}
                 }[/B]
        }
        System.Windows.Input and System.Windows.Forms are not required to override this method, so if you are not working on a drawing tool, this override can not be used, and one must use the override from the example I posted earlier.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Balage0922, Today, 07:38 AM
        0 responses
        5 views
        0 likes
        Last Post Balage0922  
        Started by JoMoon2024, Today, 06:56 AM
        0 responses
        6 views
        0 likes
        Last Post JoMoon2024  
        Started by Haiasi, 04-25-2024, 06:53 PM
        2 responses
        19 views
        0 likes
        Last Post Massinisa  
        Started by Creamers, Today, 05:32 AM
        0 responses
        6 views
        0 likes
        Last Post Creamers  
        Started by Segwin, 05-07-2018, 02:15 PM
        12 responses
        1,786 views
        0 likes
        Last Post Leafcutter  
        Working...
        X