NinjaScript > Editor > Compile Error Codes >

CS1503

Print this Topic Previous pageReturn to chapter overviewNext page

The following CS1503 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 occur when you try to assign a value to a DataSeries that is not a double value type.

 

Please ensure you are passing in or double in the Set() method. DataSeries objects can only contain double values.

 

Error Description #1
Argument '1': cannot convert from 'string' to 'double'

 

// Erroneous Sample Code - Cannot pass in a string to a DataSeries Set() method

Value.Set("Close[0]");

 

// Resolution Sample Code - Sets DataSeries to the current bar's Close value

Value.Set(Close[0]);

 

Error Description #2
Argument '1': cannot convert from 'NinjaTrader.Indicator.SMA' to 'double'

 

// Erroneous Sample Code - Cannot pass in a DataSeries object to a DataSeries Set() method

Values[0].Set(SMA(20));

 

// Resolution Sample Code - Sets DataSeries to the current bar's SMA(20) value

Values[0].Set(SMA(20)[0]);