I get this message in the output window:
You have reached the maximum threshold of the NinjaScript Output window. Some of your output messages have been suppressed.
in the log:
| 2021-02-19 14:07:58 | Default | Indicator 'MyCustomIndicator6': Error on calling 'OnBarUpdate' method on bar 0: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart. |
On the printing side it looks like the right values but without a line plot on the chart its difficult to tell by looking at values one by one.
Otherwise this is the code:

Comment