Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trying to develop session statistics indicator

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

    Trying to develop session statistics indicator

    Greetings,

    I am not a professional developer, but somehow I was able to juggle together the following NinjaSctipt indicator, which compiles without any errors.


    It's just a modification of native NT8 "NetChangeDisplay" indicator, with the addition of the following features:
    1. Current day’s range (points / ticks).
    • Calculate and display the range for the current session, displayed right next to the net change display, as “points / ticks”. For example, if I am looking at the ES (S&P E-Mini Futures), and the range for the current day (session) is 20 points, it will show as “20pt / 80t” (since 1 point = 4 ticks) for this instrument.
    1. Average range for the past number of days.
    • Calculate and display the average range for the user defined past number of days (available as an indicator property), displayed right next to the “Current day’s range”, as “Nd = average / n%”, where:
      • N = User defined number of days for the average calculation
      • d = Simply an abbreviation for “day”
      • average = average range in points
      • n% = Percentage of the average, fulfilled by the current session.
        • E.g., if the 20 day average in the ES is 50 points, and the current session range is 25 points, n% = 50 (since 25 is 50% of 50)


    Putting it together:

    Example of how a complete text string should look on my chart:

    0.10% / (25pt / 100t) / (20d = 25pt / 100%)
    • 0.10% = Net Change Display - already exists in the current indicator
    • 25pt = Current day’s range in points
    • 100t = Current day’s range in ticks
    • 20d = Average range for the past 20 days
    • 100% = Current session fulfillment of the average


    All indicator properties remain unchanged, except for adding the following parameter:

    Average Daily Range Number: (text field for numerical value input)
    • E.g., If I type “20” into this text field, it will calculate the average for the past 20 days, and also display this value in “Nd” as a “20d”.

    However, when applied to the chart in the current state, nothing happens ...

    You can find the .cs file with the full code attached to this post.


    Any ideas or suggestions are most welcome.

    God bless.

    Matt


    Attached Files

    #2
    Hello Matt,

    Thank you for your post.

    To understand why the script is behaving as it is, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    Add prints (outside of any conditions) that print the values of every variable used in every condition along with the time of the bar. ​

    The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very helpful to include labels and operators in the print to understand what is being compared in the condition sets.

    Below is a support article that details debugging using prints as well.



    If you need assistance analyzing the output please let us know.

    Comment


      #3
      How much would you pay for an indi like this?

      I've made one in tradingview, dealing with session "adr", daily ADR, weekly "adr", monthly "adr" and was thinking of porting it to NT

      Click image for larger version

Name:	image.png
Views:	106
Size:	23.7 KB
ID:	1305379​​​

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      605 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      351 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      560 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      561 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X