Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Conversion question

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

    Conversion question

    Hello,

    I am converting an indicator from 7 to 8 and cannot find the right conversion code for this :
    this.ChartControl.YAxisRangeTypeRight = YAxisRangeType.Fixed;

    Help would be welcomed


    Thanks

    #2
    Hello blar58, and thank you for your question.

    In NinjaTrader 8, the YAxisRangeType property is now a property you set panel-by-panel. Since a direct equivalent to your code is not available, and there are new concepts to understand in NinjaTrader 8, I am going to provide a more generic code sample first, then later, one that resolves your query.

    This code sample will force every panel to automatic scaling. You can try it out. Just load it into an indicator's OnBarUpdate, and then with this indicator enabled, try to adjust a scale. It will snap back to automatic after a moment each time.

    Code:
    [FONT=Courier New]foreach(ChartPanel panel in ChartControl.ChartPanels)
    {
      Print("--------------------------------------------------------------------------------");
      foreach(ChartScale scale in panel.Scales)
      {[/FONT][FONT=Courier New][FONT=Courier New]
        Print("now setting '" + scale + "' to automatic");
        [/FONT]scale.Properties.YAxisRangeType = YAxisRangeType.Automatic;
        Print("This scale is" + (scale.IsVisible ? "" : "n't") + " visible");
      }
    }[/FONT]
    ChartPanels[0] is your topmost panel, and every panel beneath it increases this index by 1.

    As far as Scales, if you run the above sample, you may get output like this :

    --------------------------------------------------------------------------------
    now setting 'Scale: Right #[B=1;I=0;S=0;D=0] min=2176.94 max=2178.06' to automatic
    This scale is visible
    now setting 'Scale: Left #[B=0;I=0;S=0;D=0] min=1.79769313486232E+308 max=-1.79769313486232E+308' to automatic
    This scale isn't visible
    now setting 'Scale: Overlay #[B=0;I=0;S=0;D=0] min=1.79769313486232E+308 max=-1.79769313486232E+308' to automatic
    This scale isn't visible
    --------------------------------------------------------------------------------
    This means that Scales[0] is your Right scale, Scales[1] is your Left scale, and Scales[2] is your Overlay scale. This also means that you can use your Scales[n].IsVisible property to determine which scales are active.

    With all that understood, then, the equivalent to your code is

    Code:
    [FONT=Courier New]foreach(ChartPanel panel in ChartControl.ChartPanels)
    {
      panel.Scales[0].Properties.YAxisRangeType = YAxisRangeType.Fixed;
    }[/FONT]
    Here is a top level documentation link, from which you can drill down into ChartPanels and Scales.



    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Great.

      Thank you very much Jessica. I will play with this.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Aviram Y, Today, 05:29 AM
      3 responses
      10 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by algospoke, 04-17-2024, 06:40 PM
      3 responses
      26 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by bmartz, 03-12-2024, 06:12 AM
      3 responses
      30 views
      0 likes
      Last Post NinjaTrader_Zachary  
      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
      7 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X