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

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
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      147 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Started by mattbsea, Today, 05:44 PM
      0 responses
      5 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      33 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      4 views
      0 likes
      Last Post tkaboris  
      Started by GussJ, 03-04-2020, 03:11 PM
      16 responses
      3,282 views
      0 likes
      Last Post Leafcutter  
      Working...
      X