Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question about populating and printing from arrays

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

    Question about populating and printing from arrays

    I need some help to get text into an array. I then need to print the contents of the array to the Output Window, each entry on its own line.

    Sample code below:

    string[] ReadMeLater = new string[];
    Code:
    if (Open[1] > 25)
    {
    
    //Type something below that will copy the text into the "ReadMeLater" string array.
    "The OPEN was greater than the assigned number."
    
    }
    
    
    
    if (Close[1] < 399)
    {
    
    //Type something below that will copy the text into the "ReadMeLater" string array.
    "The CLOSE was less than than the upper range."
    
    }

    I would then like to print both entries in the array to the Output Window when needed. I need to have each entry appear on its own line.


    Example of what should appear in Output Window:

    The OPEN was greater than the assigned number.
    The CLOSE was less than than the upper range.


    FYI, the array will contain many entries. A lot more than two. : )


    Thanks in advance.
    ​​
    Last edited by ArmKnuckle; 04-16-2023, 06:31 PM.

    #2
    Sorry, this should be in Strategy Development.

    Comment


      #3
      Hello ArmKnuckle,

      Thanks for your notes.

      I have moved your thread over to the Strategy Development section of the forums as you have noted.

      That said, using arrays is a C# concept and is not NinjaScript specific so this would fall under C# education which goes beyond the support we provide. To understand how to work with arrays in C# you could do a quick Google search for something like 'Add text to array C#' or 'print array values C#' to research this topic further.

      This forum thread will be open for other community members to provide C# education when it comes to working with arrays in C#.
      Brandon H.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,967 views
      3 likes
      Last Post jhudas88  
      Started by rbeckmann05, Today, 06:48 PM
      0 responses
      4 views
      0 likes
      Last Post rbeckmann05  
      Started by rhyminkevin, Today, 04:58 PM
      4 responses
      55 views
      0 likes
      Last Post dp8282
      by dp8282
       
      Started by iceman2018, Today, 05:07 PM
      0 responses
      6 views
      0 likes
      Last Post iceman2018  
      Started by lightsun47, Today, 03:51 PM
      0 responses
      8 views
      0 likes
      Last Post lightsun47  
      Working...
      X