CS1503

View as Markdown

CS1503

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 Description #1

Cannot implicitly convert type from ‘string’ to ‘double’

1// Erroneous Sample Code - Cannot pass in a string to a Series<double>
2Value[0] = "Close[0]";
1// Resolution Sample Code - Sets Series<double> to the current bar's Close value
2Value[0] = Close[0];

Error Description #2

Cannot implicitly convert type ‘NinjaTrader.NinjaScript.Indicators.SMA’ to ‘double’

1// Erroneous Sample Code - Cannot pass in a Series<double> object to a Series<double> Set() method
2Values[0] = SMA(20);
1// Resolution Sample Code - Sets Series<double> to the current bar's SMA(20) value
2Values[0] = SMA(20)[0];