NinjaScript > Editor > Compile Error Codes >

NT0029

Print this Topic Previous pageReturn to chapter overviewNext page

The following NT0029 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

DataSeries objects cannot be converted to another object type implicitly. You cannot simply assign the DataSeries object to an integer or a double. Please keep in mind that this does not mean the DataSeries cannot carry values that are integers or doubles, it just means you cannot assign the DataSeries itself to an integer or double.

 

To properly assign the values of a DataSeries to a variable, ensure you have included the index value to the DataSeries object.

 

Error Description #1
Cannot implicitly convert type 'NinjaTrader.Data.IDataSeries' to 'double'

 

// Erroneous Sample Code - Cannot set a DataSeries object to a double value
double closeValue = Close;

 

// Resolution Sample Code - Assign the value at index 0 (current bar)
double closeValue = Close[0];

 

Additional Error Descriptions
Cannot implicitly convert type 'double' to 'NinjaTrader.Data.IDataSeries'
Cannot implicitly convert type 'NinjaTrader.Data.IDataSeries' to 'int'
Cannot implicitly convert type 'int' to 'NinjaTrader.Data.IDataSeries'
Cannot implicitly convert type 'NinjaTrader.Data.IDataSeries' to 'bool'
Cannot implicitly convert type 'bool' to 'NinjaTrader.Data.IDataSeries'