//determine first !NaN value as divisor
int firstbar = 0;
for(int bars=1;bars<closes.Length;bars++){
if(!double.IsNaN(closes[bars])){
firstbar = Math.Max(bars,curbar); // curbar is first visible bar defined separaetly
bars = closes.Length;}}
// determine indexed vectors
VectorD vect1 = (closes / TA.Value(closes,firstbar));
Thanks Zoid, the bars ==1 is just nostalgia from my VB times with arrays base 1. This little inaccuracy will not kill my system, ahhm hopefully. Thanks for the hint! ;-)
Nop, Enumerable.FirstOrDefault does not work, only supported in: .NET Framework4.5, 4, 3. I googled a bit, but gurus also propose to loop.. Maybe QS has a way with a fancy TA.function, but in other indicators he also looped..
If not I close this question, neither does a bit of more looping kill my system..
Probably OK to loop a bit, after all the Code is presumably compiled to MSIL.
After all, as Knuth/Hoare said: "premature optimization is the root of all evil" (not that this would necessarily be premature) :-)
Ref [http://en.wikipedia.org/wiki/Program_optimization]
Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.