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

Range Calculation

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

    Range Calculation

    Forum Folk,
    • I am using the spread indicator to define an Open Hi and Lo of a session.
    • The O,H & L are subsequently displayed in a data box (if needed)
    I am wanting to use Nina to auto-calculate a range value from the Hi and Lo. Do you have any suggestions or ideas of how to go about this? I attempted to insert the "range" indicator of the spread indicator but cannot get a readout of the spread value... Should I be working with a market analyzer or a different tool inside of Ninja at this point in order to trigger the calculation?


    Thank You!
    Attached Files

    #2
    Hello Blackbull, thanks for writing in.

    It depends on what exactly you want this indicator to do. One indicator that comes to mind is the ATR (average true range) indicator. ATR is available to view from the NinjaScript editor. If you want to calculate a range based on a daily bar when the chart is intraday, you can add a 1 day series to your script to calculate from. See this guide on multi time frame scripts:

    https://ninjatrader.com/support/help...nstruments.htm

    Please let me know if you have any further questions on this material.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris,
      Thank You for your reply.
      I am simply wanting the indicator (or an indicator) (or market analyzer?) to subtract the lo from the hi.

      Comment


        #4
        Hello Blackbull, thanks for your reply.

        Did you try using a print to see what the value of your plot is coming out to? From the screenshot, it looks like whatever calculation is being done, it is coming back as Not a Number or a very very small number. e.g.

        OnBarUpdate()
        {
        Print(High[0] - Low[0]);
        Value[0] = High[0]-Low[0];
        }

        Please let me know if I can assist any further.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          I'm sorry Chris I wish I knew what a print was and how to work with them.

          Comment


            #6
            Hello Blackbull, thanks for your reply.

            The documentation for the Print method can be found here:
            https://ninjatrader.com/support/help...nt7/?print.htm

            This tool will likely be the most used debugging tool for those developing NinjaScripts. It helps us see data from the script while it is running so we can make adjustments to unexpected behavior.

            Please let me know if you have any questions on this material.
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by agclub, 04-21-2024, 08:57 PM
            4 responses
            18 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by Irukandji, Today, 04:58 AM
            0 responses
            3 views
            0 likes
            Last Post Irukandji  
            Started by fitspressoburnfat, Today, 04:25 AM
            0 responses
            2 views
            0 likes
            Last Post fitspressoburnfat  
            Started by Skifree, Today, 03:41 AM
            1 response
            4 views
            0 likes
            Last Post Skifree
            by Skifree
             
            Started by usazencort, Today, 01:16 AM
            0 responses
            1 view
            0 likes
            Last Post usazencort  
            Working...
            X