CS0200

View as Markdown

The following CS0200 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 error is most common when you try to assign values to a particular Series\<t\> index that is read-only. Instead try making your own Series<t> and assign the value there.

Error Description

Property or indexer ā€˜NinjaTrader.NinjaScript.ISeries\<double\>.this[int]’ cannot be assigned to — it is read only

Examples

Example #1

Erroneous Sample Code - Cannot assign values to something that is read-only

1Close[0] = 25;

Resolution Sample Code - Assigns value to a custom Series<double>

1myCustomClose[0] = 25;

Example #2

Erroneous Sample Code - Cannot reassign values to Series<double> indexed value and cannot have an if statement based on an assignment operator

1if (Close[0] = Open[0])

Resolution Sample Code - Properly compares two Series<double> values

1if (Close[0] == Open[0])