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

Halving ATR Line Height

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

    Halving ATR Line Height

    I like to see the range of the developing bar and that of the previous bar. I do this by employing two ATR indicators, each with a period of "1."

    For the current bar's developing range, I have "Calculate" set to "On each tick", and for the previous bar's range, "Calculate" is set to "On bar close."

    The line graphs are unimportant to me. What concerns me is the the number in the margin indicating the height. A small problem is that if a bar is tall, I need to heighten the indicator space with my mouse to read the number because it becomes truncated.

    My programming ability is limited. Looking at the ATR indicator code, I can't discern where the height of the line is computed. What would be ideal for me would be to find a variable or expression that I could put a .5 in front of, halving the height of the y components of the graph.

    Is this possible, and, if it is, can you point to where I would go to accomplish this?

    Thanks,
    Stephen

    #2
    Hello Stephen,

    You can view the logic for the ATR indicator. (New > NinjaScript Editor > Indicators > ATR)

    When you mention:
    "For the current bar's developing range, I have "Calculate" set to "On each tick", and for the previous bar's range, "Calculate" is set to "On bar close.""
    This would not be possible. The Calculate mode is set before the script begins and cannot be changed after a new instance of the script passes the State.Configured state.

    Either its Calculate 'On each tick' or its not. There is no mixing an matching.

    When you mention:
    "What concerns me is the the number in the margin indicating the height."
    Are you referring to the right side price margin?

    Is the price margin not showing the prices of the intervals on the price margin?

    You can format the price of an indicator with FormatPriceMarker(). Below is a public link to the help guide.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Images attached

      You can see in "Full Numbers" where I had to increase the height of the panel in order to see the full number. This eats into my charting area.

      The height of the tallest bar determines the height of the panel. If I could have the bar heights, I think that it would solve my problem.
      Attached Files

      Comment


        #4
        Originally posted by sgordet View Post
        You can see in "Full Numbers" where I had to increase the height of the panel in order to see the full number. This eats into my charting area.

        The height of the tallest bar determines the height of the panel. If I could have the bar heights, I think that it would solve my problem.
        try this one, remember to uncheck price marker
        Attached Files

        Comment


          #5
          Sweet.
          I also set the line to "transparent" and got exactly what I wanted.

          Very kind of you.
          Stephen

          Comment


            #6
            ~

            Hello sgordet,

            Thank you for the reply.

            The convention for controlling Y min/max values on a chart is to override OnCalculateMinMax().

            Below is a public link to the help guide about OnCalculateMinMax().



            You may create your own copy of the ATR indicator by opening ATR in a NinjaScript editor>Right click the code>Save As.

            After you have made a copy, you can add your code to the OnCalculateMinMax method. I have attached an example that the mimics the default behavior.

            The output on your screen shot would be expected if the ATR reached a value around 2 in the past. This is the way the price marker is rendered, so the screen space would need to be used to plot the higher historical value. nkhoi's post also is an excellent minimalist approach.

            Please let me know if you have any questions.
            Attached Files
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CortexZenUSA, Today, 12:53 AM
            0 responses
            1 view
            0 likes
            Last Post CortexZenUSA  
            Started by CortexZenUSA, Today, 12:46 AM
            0 responses
            1 view
            0 likes
            Last Post CortexZenUSA  
            Started by usazencortex, Today, 12:43 AM
            0 responses
            5 views
            0 likes
            Last Post usazencortex  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            168 responses
            2,265 views
            0 likes
            Last Post sidlercom80  
            Started by Barry Milan, Yesterday, 10:35 PM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X