> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# NewsItems

## Definition

**NewsItems** can be used to store news articles.

## Properties

| Property       | Description                                                |
| -------------- | ---------------------------------------------------------- |
| Items          | Collection of **NewsEventArgs** representing news articles |
| NewsToMaintain | An int representing the number of articles to maintain     |
| Update()       | For storing news articles                                  |

## Syntax

`NewsItems`

## Examples

```csharp
/* Example of storing and accessing news items from an Add On. The concept can be carried over
to any NinjaScript object you may be working on. */
public class MyAddOnTab : NTTabPage
{
     private NewsSubscription newsSubscription;
     private NewsItems newsItems;

     public MyAddOnTab()
     {
          // Subscribe to news
          newsSubscription = new NewsSubscription();
          newsSubscription.Update += OnNews;
          newsItems = new NewsItems(10);

          // Print news
          PrintNews(newsItems);
     }

     // This method is fired as new News events come in. Old News events are not provided when you subscribe.
     private void OnNews(object sender, NewsEventArgs e)
     {
          // Store the news items
          newsItems.Update(e);
     }

     // Loop through the stored news articles and output them
     private void PrintNews(NewsItems news)
     {
         for (int x = 0; x < news.Items.Count; x++)
          {
               NinjaTrader.Code.Output.Process(string.Format("ID: {0} News Provider: {1} Headline: {2}",
                    news.Items[x].Id,
                    news.Items[x].NewsProvider,
                    news.Items[x].Headline), PrintTo.OutputTab1);
          }
     }

     // Called by TabControl when tab is being removed or window is closed
     public override void Cleanup()
     {
          // Make sure to unsubscribe to the News subscription
          if (newsSubscription != null)
               newsSubscription.Update -= OnNews;
     }

     // Other required NTTabPage members left out for demonstration purposes. Be sure to add them in your own code.
}
```