Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 using list in script

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

    NT8 using list in script

    Hello,

    I can´t find a sample how to write to a list (store values in the list) and how to read from a list within a script. I found stream writer with writing to a file and stream read to read from a file and also a script plotting SR lines from a file. But no sample how to add doubles or ints to a list in a script.

    Thank you!
    Tony

    #2
    Hello tonynt,

    Thanks for your post.

    This is a C# type question as there are no references to list in the NT8 Ninjascript help guide.

    You can do an internet search for C# list examples and you will find many examples. One public site I use is: https://www.dotnetperls.com/list

    I will attach an example indicator of using List in a Ninjascript indicator but if you have further questions please research the answers using the internet.

    To best use the example, add a 20 SMA and 100 SMA to a chart with a few days of data. The indicator will look for every crossabove and will draw a dot below the low[0] on each cross above to show on the chart where it found the crossabove. In the script, the List is used to store the bar number where the cross occurred. Once the chart reaches real time data, it will print the list of all the crosses found in the historical data and then reprint the last two items in the list. The print will be sent to the output window. This is a very basic example of list and again if you have further questions on use to seek answers from the internet as this is not a ninjascript question.


    ListTest.zip

    Comment


      #3
      Thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      574 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      333 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X