I'm experiencing the same (or similar) problem. The situation is the following:
- NT 8 v 8.0.26.1 64-bit
- Two dataseries in a strategy. The secondary dataserie was added using AddDataSeries() as shown in the languaje reference
- First dataseries: CL 12-22 ; Secondary dataseries: GC 12-22
- In the chart there are both instruments added: CL in panel 1 and GC in panel 2
- Manually I added an SMA(30) to both instruments
- In the strategy I added the sames SMAs(30) to both sataseries. The SMA for the first dataseries (CL 12-22) plots just over the SMA manually added to the chart, but there are not coincidence between the SMAs for the secondary dataseries (GC 12-22). In the beginnig of the chart (leftmost candles), the SMAs for the secondary dataseries are plotted exactly one over the other, but as long as you move to the right (later candles) the SMA added by script starts to stretch to the right. Both SMAs (added manually to the chart and added by script) has the same period of 30 candles.
This is the coded where I added the SMAs:
if (State == State.SetDefaults)
{
if (State == State.DataLoaded)
{
SMA_DS_1 = SMA(BarsArray[0], 30);
AddChartIndicator(SMA_DS_1);
ChartIndicators[0].Panel = 0;
SMA_DS_2 = SMA(BarsArray[1], 30);
AddChartIndicator(SMA_DS_2);
ChartIndicators[1].Panel = 1;
}
...
See the attached screens. The first one shows the beginning of the chart (leftmost candles) and the second one shows where the added SMA by script is out of sync.
Any suggestions?
Thanks in advance,
Javier
Comment