Support Board
Date/Time: Sat, 28 Dec 2024 09:53:31 +0000
sc.GetChartBaseData((-1 * ChartNum), RemoteBaseData) not aligning arrays
View Count: 980
[2016-02-13 00:44:41] |
bjohnson777 (Brett Johnson) - Posts: 284 |
I'm having trouble with the arrays aligning when using sc.GetChartBaseData(). I'm testing with historical daily bars. I'm still using UNG and UGAZ for simple tests. It looks like the correct data loads then there are a thousand or so zero's until "sc.ArraySize-1". The last number before the zero's start is the correct close for today. For sc.GetChartBaseData(), shouldn't a negative chart number align today's daily close at array index "sc.ArraySize-1"? Debugging output correctly shows UNG as chart 2 and UGAZ as chart 3 (listed as ChartNum and CNum in the debug output). This is the code I'm using with some debugging: sc.GetChartBaseData((-1 * pStockIndexArray[i].ChartNumber), RemoteBaseData); //sync charts //debug print out array. for(index=0; index < sc.ArraySize; index++) { sprintf(debugstr, "data \"%s\" %d %f", pStockIndexArray[i].Symbol, index, RemoteBaseData[pInputDataIndex][index]); debug_PrintStringToFile(debugstr); } sprintf(debugstr, "High/Low 1: Sym=\"%s\" CNum=%d 0=%f now=%f sc.ArraySize=%d sc.Index=%d", pStockIndexArray[i].Symbol, pStockIndexArray[i].ChartNumber, RemoteBaseData[pInputDataIndex][0], RemoteBaseData[pInputDataIndex][sc.Index], sc.ArraySize, sc.Index); debug_PrintStringToFile(debugstr); //Find high/low code clipped for space. What matters is above this line of code. sprintf(debugstr, "High/Low 2: Sym=\"%s\" CNum=%d high=%f low=%f PO=%f Mul=%f bars=%d sc.ArraySize=%d sc.Index=%d", pStockIndexArray[i].Symbol, pStockIndexArray[i].ChartNumber, high, low, pStockIndexArray[i].PriceOffset, pStockIndexArray[i].Multiplier, bars, sc.ArraySize, sc.Index); debug_PrintStringToFile(debugstr); Here is the debug output. The "data" lines are the arrays printed out at the index number. Node 0: Symbol="ung" Weight=1.2000 ChartNum=2 PriceOffset=0.0000 Multiplier=1.0000 Node 1: Symbol="ugaz" Weight=0.3000 ChartNum=3 PriceOffset=0.0000 Multiplier=1.0000 data "ung" 0 406.160004 data "ung" 1 404.480011 data "ung" 2 396.320007 (clipped for space) data "ung" 2221 7.300000 data "ung" 2222 7.220000 data "ung" 2223 0.000000 data "ung" 2224 0.000000 (clipped for space) data "ung" 3019 0.000000 High/Low 1: Sym="ung" CNum=2 0=406.160004 now=0.000000 sc.ArraySize=3020 sc.Index=3019 High/Low 2: Sym="ung" CNum=2 high=0.000000 low=0.000000 PO=0.000000 Mul=1.000000 bars=250 sc.ArraySize=3020 sc.Index=3019 data "ugaz" 0 241.800003 data "ugaz" 1 248.500000 data "ugaz" 2 254.699997 (clipped for space) data "ugaz" 1007 1.390000 data "ugaz" 1008 1.340000 data "ugaz" 1009 0.000000 data "ugaz" 1010 0.000000 (clipped for space) data "ugaz" 3019 0.000000 High/Low 1: Sym="ugaz" CNum=3 0=241.800003 now=0.000000 sc.ArraySize=3020 sc.Index=3019 High/Low 2: Sym="ugaz" CNum=3 high=0.000000 low=0.000000 PO=0.000000 Mul=1.000000 bars=250 sc.ArraySize=3020 sc.Index=3019 Thanks |
[2016-02-17 10:04:03] |
Sierra Chart Engineering - Posts: 104368 |
You will never get an alignment and you can never expect it with this function. Here is the relevant documentation: https://www.sierrachart.com/index.php?page=doc/doc_ACSILRefOtherTimeFrames.php#AccessingCorrectArrayIndexes Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
To post a message in this thread, you need to log in with your Sierra Chart account: