NinjaScript > Editor > Compile Error Codes >

NT0019

Print this Topic Previous pageReturn to chapter overviewNext page

The following NT0019 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 can happen when a DataSeries is compared to another object via the use of relational operators. Relational operators (==, <, >, <=, >=) can be used to compare the values of the DataSeries but not the DataSeries object itself.

 

To fix this error ensure that you are actually comparing the values of the DataSeries to another object. You can do this by adding the index value to the DataSeries call. The index value is on a zero-based referencing system. [0] references the latest bar while [1] references one bar ago and [2] references two bars ago.

 

Error Description #1
Operator '>' cannot be applied to operands of type 'NinjaTrader.Data.IDataSeries' and 'int'

 

// Erroneous Sample Code - DataSeries objects cannot be compared with integers
if (Close == 5)

 

// Resolution Sample Code - Checks to see if the current close is equal to 5
if (Close[0] == 5)

 

Error Description #2
Operator '==' cannot be applied to operands of type 'int' and 'NinjaTrader.Data.IDataSeries'

 

// Erroneous Sample Code - DataSeries objects cannot be compared with each other
if (Close > Open)

 

// Resolution Sample Code - Checks to see if the current bar’s close is greater than the current bar’s open
if (Close[0] > Open[0])

 

Error Description #3
Operator '>' cannot be applied to operands of type 'NinjaTrader.Data.IDataSeries' and 'NinjaTrader.Data.IDataSeries'

 

// Erroneous Sample Code - DataSeries objects cannot be compared with doubles

while (Low < Close[1])

 

// Resolution Sample Code - While the current low is less than the previous close continue with this code segment

while (Low[0] < Close[1])