Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Converting an indicator

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

    Converting an indicator

    I am converting an indicator from NT7 to Nt8.

    I will need some help because I can't find the conversion code needed.
    The expressions that I have problems with are the following :

    the NT7 indicator uses :

    ChartControl.CanvasTop and CanvasBottom
    ChartControl.Size.Width
    ChartControl.ChartPAnel.Invalidate
    ChartControl.ActiveControl.HotSpot.Y
    ChartControl.FixedPanelMaxRight
    ChartControl.GetYByValue(this, this.ChartControl.FixedPanelMinRight
    ChartControl.YAxisRangeTypeRight

    Thank you for your help.
    Last edited by blar58; 08-29-2016, 04:06 PM.

    #2
    Hello blar58,

    I will investigate these undocumented items and will update this thread when I have further information.
    Thanks in advance for your patience.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello blar58,

      Here is a list of most of the requested items and what I think are the equivalents:

      CanvasTop: http://ninjatrader.com/support/helpG...chartpanel.htm
      Canvasbottom: http://ninjatrader.com/support/helpG...chartpanel.htm
      Width: http://ninjatrader.com/support/helpG...chartpanel.htm
      Invalidate: http://ninjatrader.com/support/helpG...rcerefresh.htm
      FixedPanelMaxRight: http://ninjatrader.com/support/helpG...chartpanel.htm
      GetYByValue: http://ninjatrader.com/support/helpG...etvaluebyy.htm
      YAxisRangeTypeRight: http://ninjatrader.com/support/helpG...chartpanel.htm


      For ChartControl.ActiveControl.HotSpot.Y, please provide further information on how this is used so that we might find what you need for Ninjatrader 8.
      Paul H.NinjaTrader Customer Service

      Comment


        #4
        Thank you very much Paul.

        I can see that ChartPanel owns now the methods that used to be in ChartControl (in NT7).

        I am not the one who created that indicator but here's how it is used in the code :

        //Cursor HotSpot exploit. Only the "Hand" cursor has Y value of 1.
        //if(e.Button == MouseButtons.Left && ChartControl.ActiveControl.Cursor.HotSpot.Y == 1)


        Thanks

        Comment


          #5
          Hello blar58,

          Thanks for your reply.

          We would be unable to advise further on that bit of code. Nearest thing would be http://ninjatrader.com/support/helpG...edownpoint.htm

          Perhaps others in the community might assist on this.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Is seems that it tries to know if the mouse is showing a hand ?

            something like that

            Comment


              #7
              I have also a Error on calling OnStsteChange method: Oject reference not set to an instnce of an object.
              Here is my OnState Change method without the State.Default because I know it is not coming from that state :

              Code:
              else if (State == State.DataLoaded)
              {
                 if (ChartControl != null)
                 {
                      ChartControl.PreviewMouseLeftButtonDown += MouseDown_OnChart;
                      ChartControl.PreviewMouseLeftButtonUp += MouseDrag_OnScale
                      ChartControl.PreviewMouseMove += MouseDrag_OnChart;
                      ChartControl.PreviewMouseWheel    +=EnableAutoScroll;					
                  }
                                 
              }
              else if (State == State.Historical)
              {
                      foreach (ChartPanel chartPanel in ChartControl.ChartPanels)
                      {
                   
                       foreach (ChartScale scale in chartPanel.Scales)
                       {
                         if (scale.ScaleJustification == ScaleJustification.Right)
              	scale.Properties.YAxisRangeType = YAxisRangeType.Fixed;
                       }
                      }
              									}			
              else if (State == State.Terminated)
              {		
              	if (ChartControl != null)
                              {
                                  ChartControl.PreviewMouseLeftButtonDown -= MouseDown_OnChart;
                                  ChartControl.PreviewMouseLeftButtonUp -= MouseDrag_OnScale;
              	      ChartControl.PreviewMouseMove -= MouseDrag_OnChart;
              	      ChartControl.PreviewMouseWheel - = EnableAutoScroll;					
                              }
              				
              		
              	foreach (ChartPanel chartPanel in ChartControl.ChartPanels)
              	{
              	foreach (ChartScale scale in chartPanel.Scales)
              	{
                             if (scale.ScaleJustification == ScaleJustification.Right)
              	      scale.Properties.YAxisRangeType = YAxisRangeType.Automatic;
              	}
                            }					   
              }

              Comment


                #8
                Originally posted by blar58 View Post
                I have also a Error on calling OnStsteChange method: Oject reference not set to an instnce of an object.
                Here is my OnState Change method without the State.Default because I know it is not coming from that state :

                Code:
                else if (State == State.DataLoaded)
                {
                   if (ChartControl != null)
                   {
                        ChartControl.PreviewMouseLeftButtonDown += MouseDown_OnChart;
                        ChartControl.PreviewMouseLeftButtonUp += MouseDrag_OnScale
                        ChartControl.PreviewMouseMove += MouseDrag_OnChart;
                        ChartControl.PreviewMouseWheel    +=EnableAutoScroll;					
                    }
                                   
                }
                else if (State == State.Historical)
                {
                        foreach (ChartPanel chartPanel in ChartControl.ChartPanels)
                        {
                     
                         foreach (ChartScale scale in chartPanel.Scales)
                         {
                           if (scale.ScaleJustification == ScaleJustification.Right)
                	scale.Properties.YAxisRangeType = YAxisRangeType.Fixed;
                         }
                        }
                									}			
                else if (State == State.Terminated)
                {		
                	if (ChartControl != null)
                                {
                                    ChartControl.PreviewMouseLeftButtonDown -= MouseDown_OnChart;
                                    ChartControl.PreviewMouseLeftButtonUp -= MouseDrag_OnScale;
                	      ChartControl.PreviewMouseMove -= MouseDrag_OnChart;
                	      ChartControl.PreviewMouseWheel - = EnableAutoScroll;					
                                }
                				
                		
                	foreach (ChartPanel chartPanel in ChartControl.ChartPanels)
                	{
                	foreach (ChartScale scale in chartPanel.Scales)
                	{
                               if (scale.ScaleJustification == ScaleJustification.Right)
                	      scale.Properties.YAxisRangeType = YAxisRangeType.Automatic;
                	}
                              }					   
                }
                And another one bites the dust!

                You are using State.Terminated to unsubscribe from event handlers. You are being killed by unintended side-effects that so far are not going to be properly fixed.

                ref: http://ninjatrader.com/support/forum...ate.terminated

                There is a hacky, kludgy, workaround somewhere in that thread, that NT has decided to adopt as a solution instead of fixing the design.

                Comment


                  #9
                  Originally posted by blar58 View Post
                  I have also a Error on calling OnStsteChange method: Oject reference not set to an instnce of an object.
                  koganam is correct and is referring to the following post: http://ninjatrader.com/support/forum...0&postcount=17

                  Please let me know if you have any questions on that post.

                  I believe you would only need MouseDownPoint for the Y of where the mouse is during a button click: http://ninjatrader.com/support/helpG...edownpoint.htm

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by usazencort, Today, 01:16 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post usazencort  
                  Started by kaywai, 09-01-2023, 08:44 PM
                  5 responses
                  603 views
                  0 likes
                  Last Post NinjaTrader_Jason  
                  Started by xiinteractive, 04-09-2024, 08:08 AM
                  6 responses
                  22 views
                  0 likes
                  Last Post xiinteractive  
                  Started by Pattontje, Yesterday, 02:10 PM
                  2 responses
                  21 views
                  0 likes
                  Last Post Pattontje  
                  Started by flybuzz, 04-21-2024, 04:07 PM
                  17 responses
                  230 views
                  0 likes
                  Last Post TradingLoss  
                  Working...
                  X