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

    Comment


      #3
      Thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Austiner87, Today, 09:43 AM
      0 responses
      1 view
      0 likes
      Last Post Austiner87  
      Started by RobotSyndicate, Today, 09:20 AM
      0 responses
      1 view
      0 likes
      Last Post RobotSyndicate  
      Started by fx.practic, Today, 08:22 AM
      2 responses
      5 views
      0 likes
      Last Post fx.practic  
      Started by brownsfan019, Today, 08:01 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_PatrickG  
      Started by cmarkb, Today, 01:18 AM
      2 responses
      30 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X