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

Plotting Indicators on Logarithmic Scale

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

    Plotting Indicators on Logarithmic Scale

    Dear Support,

    What is the correct way to plot an indicator on logarithmic Y-scale in Panel 2?

    Using the following script under (State == State.SetDefaults) does not work because it is a type.

    Code:
    YAxisScalingType = chartScale.Properties.YAxisScalingType.Logarithmic
    Also, I know that I can manually change YAxis to Logarithmic on Y Axis properties. But, I want for the indicator itself to plot as logarithmic.

    Thanks.

    #2
    Hello

    To use the chartscale properties you would have to use the syntax in the opposite way that you are now:

    Code:
    chartScale.Properties.YAxisRangeType = YAxisRangeType.Automatic;
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello

      To use the chartscale properties you would have to use the syntax in the opposite way that you are now:

      Code:
      chartScale.Properties.YAxisRangeType = YAxisRangeType.Automatic;
      I look forward to being of further assistance.
      Thank you Jesse.

      The above syntax placed under State == State.SetDefaults produces the following error CS0103, " The name "chartScale does not exist in the current context"

      Thanks.

      Comment


        #4
        Hello aligator,

        The error is correct, that does not exist in OnStateChange. The code you provided looks as if it was pulled from another scripts OnRender override or a sample using OnRender because of the lowercase chartScale variable.

        That code would go in OnRender so if you pulled that from another script which used it in OnRender that would be what you need to replicate in your script as well. You otherwise need the OnRender override and then to add the code there.

        https://ninjatrader.com/support/help...htsub=onrender

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello aligator,

          The error is correct, that does not exist in OnStateChange. The code you provided looks as if it was pulled from another scripts OnRender override or a sample using OnRender because of the lowercase chartScale variable.

          That code would go in OnRender so if you pulled that from another script which used it in OnRender that would be what you need to replicate in your script as well. You otherwise need the OnRender override and then to add the code there.

          https://ninjatrader.com/support/help...htsub=onrender

          I look forward to being of further assistance.
          Thanks Jesse,

          Yes, I pulled that code from the help documentation, but it works only in OnRender.
          I did not find a Sample indicator that provide options for the YAxis RangeType and ScalingType. However, I added statements for both YAxisScalingType and YAxisRangeType for my indicator as the following code and worked fine.

          Code:
          protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
          {
          // call the base.OnRender() to ensure standard Plots work as designed
          base.OnRender(chartControl, chartScale);
          
          chartScale.Properties.YAxisRangeType = YAxisRangeType.Automatic;
          chartScale.Properties.YAxisScalingType = YAxisScalingType.Logarithmic;
          }
          Perhaps it would be nice to include in Help section (or in forum) a sample indicator that would provide options for Y axis scaling type and range type using a couple of enums, Such a sample indicator would be really useful for unbounded indicators or even historical price chart with large price movements.

          Many thanks for your help.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by RaddiFX, Yesterday, 11:57 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Marco  
          Started by Tonofit, Today, 12:00 AM
          0 responses
          1 view
          0 likes
          Last Post Tonofit
          by Tonofit
           
          Started by ck6libra, Yesterday, 11:20 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by witipica, Yesterday, 10:02 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_ChrisSch  
          Started by rtwave, Yesterday, 09:52 PM
          0 responses
          8 views
          0 likes
          Last Post rtwave
          by rtwave
           
          Working...
          X