I am plotting an indicator which generates series objects of close prices of two symbols
1. The current symbol on active chart
2. The weekly closing prices of gold
However the final plot generated errors. On debugging i found that the object series (closing prices of current symbol and that of Gold) has double values for 1st and last series values.
For example for a time template of standard 300 bars, the bar indexs -299 and 0 are shown twice in the series in the output window.
Furthur, for bar index -299 the gold weekly close is returned null first time and actual close the second time.
Whats the problem?
I am attaching 2 snapshots of formula output window to this mail. One shows the double 0 index values at the top and the other the double -299 index values at the bottom.
furthur modification of code revealed that the bottom most or the 1st value of series (-299) war returning actual value for the chart symbol but null value for the gold symbol.
Following is my relevant code section :
if (bInit == false) {
nComm = close();
nGold = close(sym("GC #F=1, W"));
bInit = true;
}
debugPrintln(getCurrentBarIndex(), " ",nComm," ", nGold);
1. The current symbol on active chart
2. The weekly closing prices of gold
However the final plot generated errors. On debugging i found that the object series (closing prices of current symbol and that of Gold) has double values for 1st and last series values.
For example for a time template of standard 300 bars, the bar indexs -299 and 0 are shown twice in the series in the output window.
Furthur, for bar index -299 the gold weekly close is returned null first time and actual close the second time.
Whats the problem?
I am attaching 2 snapshots of formula output window to this mail. One shows the double 0 index values at the top and the other the double -299 index values at the bottom.
furthur modification of code revealed that the bottom most or the 1st value of series (-299) war returning actual value for the chart symbol but null value for the gold symbol.
Following is my relevant code section :
if (bInit == false) {
nComm = close();
nGold = close(sym("GC #F=1, W"));
bInit = true;
}
debugPrintln(getCurrentBarIndex(), " ",nComm," ", nGold);