NinjaScript > Editor > Compile Error Codes >

CS0200

Print this Topic Previous pageReturn to chapter overviewNext page

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 DataSeries index through the use of assignment operators (=). Since DataSeries objects have their values set through the Set() method, you cannot modify the value after it has been set through the use of assignment operators.

 

DataSeries indexed values are read only and cannot be changed through assignment operators. If you wish to set the latest value of the DataSeries please use the Set() method.

 

Error Description
Property or indexer 'NinjaTrader.Data.IDataSeries.this[int]' cannot be assigned to -- it is read only

 

Example #1

// Erroneous Sample Code - Cannot reassign values to DataSeries indexed value

Close[0] = 25;

 

// Resolution Sample Code - Assigns value to a DataSeries

myClose.Set(25);

 

Example #2

// Erroneous Sample Code - Cannot reassign values to DataSeries indexed value and cannot have an if statement based // on an assignment operator

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

 

// Resolution Sample Code - Properly compares two DataSeries values

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