Problem 1: For small (<21) Period existing SMA takes too long to display.
Example: If user has a 60 minute bar chart and SMA(2), they would expect this to start to display after 2 hours, But currently the user has to wait for 21 hours! (assuming a datafeed where you cant fetch historical minute bars).
This is because the current NT code does not set BarsRequired, so its value seems to default to 20.
Solution: Set BarsRequired=1
Problem 2: For large (>21) period existing SMA displays misleading value until Period bars have been received.
Example: If user requests display of SMA(100) this will actually be displaying SMA(21) at 21st bar, SMA(22) at 22nd bar etc, and is only accurate when reaches 100th bar.
Solution: Don't start setting value until Period (non null) bars have been received.
Problem 3: If an Input value has not been Set then NT just includes the Close value for that bar in the SMA.
This gives inaccurate average in cases where SMA is being used on an "Input Series" which is an indicator where the values are sometimes not set by user (to indicate "unknown" or "not applicable" or "no solution" as per Null in SQL).
Solution: NT need to expose to user the state of Input[i] (has it been Set or not?).
The information must already exist inside NT otherwise ContainsValue (on a specific named series) would not work.
How about exposing the state using something like "InputIsSet[i]" eg
if (InputIsSet[i]) {//include Input[i] in the average }
if (Input.ContainsValue(i))
if (Input[i].IsSet)
Instead I have to use a kludge such as "always set a value in indicator once you start setting values, even if the value is really unknown (so dont want to set)".
In SQL using AVG on a column with nulls, excludes the nulls from the calculation, Users should be able to implement something similar in NT if they require this.
Comment