TulipCharts / tinet

Tulip Indicators bindings for .NET (Technical Analysis)
https://tulipindicators.org
GNU Lesser General Public License v3.0
29 stars 11 forks source link

KVO output returns 54 values per run when longPeriods = 54 #2

Closed snoop244 closed 4 years ago

snoop244 commented 4 years ago

I'm new to all of this, so apologies if it is a stupid question.

I used your example to get SMA working. I feed it a rolling window of 7 values on each run and get a singe value back. It is the accurate SMA and behaves as expected.

With KVO I feed it the same rolling window object, but with 54 values, and run exactly the same code (but provide the proper parameters). Instead of a single value, I get 54 values back - none of which match the KVO that IBKR provides. Before I try to address the Tulip vs IBKR problem, I'm trying to figure out why I'm not just getting a single KVO back. Here is my code:

                double[] options = new double[] { 34, 54}; 
                //Find output size and allocate output space.
                int output_length = windowLength - tinet.indicators.kvo.start(options);
                double[] output = new double[output_length];

                double[][] inputs = { highPrices, lowPrices, closePrices, volumes };
                double[][] outputs = { output };
                int success = tinet.indicators.kvo.run(inputs, options, outputs);

                Console.WriteLine("Input bars:");
                Console.WriteLine(string.Join(",", closePrices));

                Console.WriteLine("KVO Output");
                Console.WriteLine(string.Join(",", output));
codeplea commented 4 years ago

What is windowLength?

Can you post a complete example? (i.e. define all variables)

Alternatively, log to console all your inputs, options, and outputs, then post the results here.

codeplea commented 4 years ago

By the way, KVO will return an output array that is 1 shorter than the input array. It doesn't matter what your options are. You can see that math at: https://tulipindicators.org/kvo

snoop244 commented 4 years ago

Ok. That would explain it. I thought KVO would be a single value based those input values. I'll have a look at the math. Thanks for your help.