> 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.

# Trend Lines

## Description

When a high swing is followed by a lower high swing, a trend line high is automatically plotted. When a low swing is followed by a higher low swing, a trend line low is automatically plotted.

## Syntax

`TrendLines(int strength, int numberOfTrendLines, int oldTrendsOpacity, bool alertOnBreak)`

`TrendLines(ISeries\<double\> input, int strength, int numberOfTrendLines, int oldTrendsOpacity, bool alertOnBreak)`

## Return Value

**double**; Accessing this method via an index value `[int barsAgo]` returns the indicator value of the referenced bar

## Parameters

| Property           | Description                                                                                     |
| ------------------ | ----------------------------------------------------------------------------------------------- |
| input              | Indicator source data ([Series\<T>](/developer/desktop-sdk/references/common/iseriest/seriest)) |
| strength           | The number of required bars to the left and right of the swing point                            |
| numberOfTrendLines | The number of recent trend lines to plot                                                        |
| oldTrendOpacity    | The opacity to apply to old trend lines                                                         |
| alertOnBreak       | Sets if there should be an alert when the price breaks the current trend line                   |

## Examples

```csharp
// Prints the current value of a 5 strength Trend Lines
double value = TrendLines(5, 4, 25, true)[0];
Print("The current Trend Lines value is " + value.ToString());
```