I am trying to test my custom build indicator on a simulated data feed and it does not work, I narrowed down my problem to a simple problem: "double s = SMA(20)[0];" gives an error "Error on calling the 'OnBarUpdate' method for indicator 'EMArate2cross' on bar 0: Index was out of range. Must be non-negative and less than the size of the collection.", and I have more than 20 bars on my screen.
I see data on my chart and simple SMA(20) plots fine but why I can not use output of SMA(20)[0] in my program. Is it something related to a simulated data feed?
In general I want to do something like this
for (int i=0; i<10; i++) sum = sum + SMA(20)[i];
Sergey.
Comment