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

Platform exceptions

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

    Platform exceptions

    Hello

    A user report these errors. Trace attached.
    As I can see something bad happened with UI events handling inside the platform.

    I use this code for attaching input events handlers to indicators

    PHP Code:
    // indicator class
            
    protected MouseEventHandler handlerOnMouseMove;
            protected 
    MouseButtonEventHandler handlerOnMouseDown;
            protected 
    MouseButtonEventHandler handlerOnMouseUp;
            protected 
    MouseButtonEventHandler handlerOnMouseDoubleClick;
            protected 
    KeyEventHandler handlerOnKeyDown;
            protected 
    KeyEventHandler handlerOnKeyUp;

            public 
    void AttachEventHandlers()
            {
                if (
    GetChartPanel() != null)
                {
                    
    handlerOnMouseMove = new MouseEventHandler(IndicatorMVC.OnMouseMove);
                    
    GetChartPanel().MouseMove += handlerOnMouseMove;

                    
    handlerOnMouseDown = new MouseButtonEventHandler(IndicatorMVC.OnMouseDown);
                    
    GetChartPanel().MouseDown += handlerOnMouseDown;

                    
    handlerOnMouseUp = new MouseButtonEventHandler(IndicatorMVC.OnMouseUp);
                    
    GetChartPanel().MouseUp += handlerOnMouseUp;

                    
    handlerOnMouseDoubleClick = new MouseButtonEventHandler(IndicatorMVC.OnMouseDoubleClick);
                    
    GetChartPanel().MouseDoubleClick += handlerOnMouseDoubleClick;

                    
    handlerOnKeyDown = new KeyEventHandler(IndicatorMVC.OnKeyDown);
                    
    GetChartPanel().KeyDown += handlerOnKeyDown;

                    
    handlerOnKeyUp = new KeyEventHandler(IndicatorMVC.OnKeyUp);
                    
    GetChartPanel().KeyUp += handlerOnKeyUp;
                }
            }

            public 
    void DetachEventHandlers()
            {
                if (
    GetChartPanel() != null)
                {
                    if (
    handlerOnMouseMove != null) { GetChartPanel().MouseMove -= handlerOnMouseMovehandlerOnMouseMove null; }
                    if (
    handlerOnMouseDown != null) { GetChartPanel().MouseDown -= handlerOnMouseDownhandlerOnMouseDown null; }
                    if (
    handlerOnMouseUp != null) { GetChartPanel().MouseUp -= handlerOnMouseUphandlerOnMouseUp null; }
                    if (
    handlerOnMouseDoubleClick != null) { GetChartPanel().MouseDoubleClick -= handlerOnMouseDoubleClickhandlerOnMouseDoubleClick null; }
                    if (
    handlerOnKeyDown != null) { GetChartPanel().KeyDown -= handlerOnKeyDownhandlerOnKeyDown null; }
                    if (
    handlerOnKeyUp != null) { GetChartPanel().KeyUp -= handlerOnKeyUphandlerOnKeyUp null; }
                }
            }

            public 
    ChartPanel GetChartPanel()
            {
                return (
    MasterIndicator == null) ? ChartPanel MasterIndicator.ChartPanel;
            }

            protected 
    override void OnStateChange()
            {
                ...

                else if (
    State == State.Historical)
                {
                    
    AttachEventHandlers();
                    ...
                }
                else if (
    State == State.Terminated)
                {
                    
    DetachEventHandlers(); 
                    ...
                } 
    Any advice?
    Last edited by NinjaTrader_ChelseaB; 08-20-2017, 07:53 AM.

    #2
    Hello ren37,

    The log and trace files contain sensitive information.

    Please do not post the log or trace or any other personal information on the forums.

    Please send an email to platformsupport [at] ninjatrader [dot] com for further assistance.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Ok, but there was no personal info.

      Comment


        #4
        Hello ren37,

        The MachineID can be used to license scripts for unauthorized machines. This is included with the log and trace files.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          My indicators use another machine id for license checking.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ghoul, Today, 06:02 PM
          3 responses
          14 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          44 views
          0 likes
          Last Post jeronymite  
          Started by Barry Milan, Yesterday, 10:35 PM
          7 responses
          20 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by AttiM, 02-14-2024, 05:20 PM
          10 responses
          180 views
          0 likes
          Last Post jeronymite  
          Started by DanielSanMartin, Yesterday, 02:37 PM
          2 responses
          13 views
          0 likes
          Last Post DanielSanMartin  
          Working...
          X