Here are code excerpts, representing the problem and a possible workaround. What I'd like to know is exactly what am I running into that's limiting me to six numbers passed? Could be the length of the string(doubtful), some kind of line length limit(?) or something else.
Help!
Here's the original code that builds a string of moving averages and
passes it over to Excel. 'xxx'-'aaa' are various moving averages, the
length of which don't pertain to my questions. Multi-line formatting
for readability. Max of six of these moving average numbers in a single statement.
excelSheet.Cells[rownum,3] = SMA(BarsArray[0], 50)[0].ToString("N2")+" "+
SMA(BarsArray[0],100)[0].ToString("N2")+" "+
SMA(BarsArray[0],xxx)[0].ToString("N2")+" "+
SMA(BarsArray[0],yyy)[0].ToString("N2")+" "+
SMA(BarsArray[0],zzz)[0].ToString("N2")+" "+
SMA(BarsArray[0],aaa)[0].ToString("N2");
Workaround: stash groups of six moving averages into variables, then pass those variables to Excel:
d1 = SMA(BarsArray[0], 50)[0].ToString("N2")+" "+
SMA(BarsArray[0],100)[0].ToString("N2")+" "+
SMA(BarsArray[0],xxx)[0].ToString("N2")+" "+
SMA(BarsArray[0],yyy)[0].ToString("N2")+" "+
SMA(BarsArray[0],zzz)[0].ToString("N2")+" "+
SMA(BarsArray[0],aaa)[0].ToString("N2");
d2 = SMA(BarsArray[1], 50)[0].ToString("N2")+" "+
SMA(BarsArray[1],100)[0].ToString("N2")+" "+
SMA(BarsArray[1],xxx)[0].ToString("N2")+" "+
SMA(BarsArray[1],yyy)[0].ToString("N2")+" "+
SMA(BarsArray[1],zzz)[0].ToString("N2")+" "+
SMA(BarsArray[1],aaa)[0].ToString("N2");
excelSheet.Cells[rownum,5] = d1+" "+d2+" ";
So, by assigning no more than six moving averages to a variable, I can stack these up, concatenate the variables together and successfully pass them to Excel.
I have many strings, consisting of many, many numbers I want to pass to Excel, so can you tell me what I'm up against here?
Thanks...
P.S. I accidentally posted this in the NT8 section. I'm still running NT7, but instead of moving this post around a bunch, can you still help me out? Or, maybe move it to NT7 section for me...
Comment