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 bmartz, 03-12-2024, 06:12 AM
          5 responses
          33 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by Aviram Y, Today, 05:29 AM
          4 responses
          13 views
          0 likes
          Last Post Aviram Y  
          Started by algospoke, 04-17-2024, 06:40 PM
          3 responses
          28 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by gentlebenthebear, Today, 01:30 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by cls71, Today, 04:45 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X