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

# CS0021

The following **CS0021** error code information is provided within the context of **NinjaScript**. The examples provided are only a subset of potential problems that this error code may reflect. In any case, the examples below provide a reference of coding flaw possibilities.

## Error Code Explanation

This is a common error when calling indicators methods. It occurs when an indicator is called without its required parameter arguments before accessing an indexed value.

To fix this error you will need to first pass to the indicator method all the necessary parameter arguments. You can do this with `()` after the indicator name. Please note that you will still need to pass an empty parameter argument list even if your indicator requires no arguments.

## Error Description #1

Cannot apply indexing with **\[]** to an expression of type **'method group'**

## Examples

### Example #1

Erroneous Sample Code - **SMA** is an indicator and requires parameter arguments

```csharp
double value = SMA[0];
```

Resolution Sample Code - **SMA()** properly called

```csharp
double value = SMA(14)[0];
```

### Example #2

Erroneous Sample Code - **EMA** is an indicator and requires parameter arguments

```csharp
double maDelta = EMA[0] - EMA[1];
```

Resolution Sample Code - **SMA()** properly called with an overload method (one of several variations)

```csharp
double maDelta = EMA(High, 14)[0] - EMA(High, 14)[1];
```