forum.alglib.net http://forum.alglib.net/ |
|
The problem with the approximation\ alglib+alglibexception http://forum.alglib.net/viewtopic.php?f=2&t=3945 |
Page 1 of 2 |
Author: | Papercut110 [ Thu Feb 21, 2019 4:48 pm ] |
Post subject: | The problem with the approximation\ alglib+alglibexception |
Hello, I need to approximate the price range. To do this, I have connected the alglib library to the ninjatrader trading platform. But since I'm not very familiar with the approximation principle, there are problems with the code. If you set n to 2, everything works, but if n is set to more than two, an alglib+alglibexception error appears. If the value is 2, the curve approximation is exactly the same curve prices, but a challenge to build a more smooth curve. Please help newbie |
Author: | Sergey.Bochkanov [ Thu Feb 21, 2019 9:53 pm ] |
Post subject: | Re: The problem with the approximation\ alglib+alglibexcepti |
What is the value of msg field of the exception object? It usually contains some short description of the error. |
Author: | Papercut110 [ Sat Feb 23, 2019 6:32 am ] |
Post subject: | Re: The problem with the approximation\ alglib+alglibexcepti |
If, for example, put n = 4 x 2779 y 4 i 1 Time 18.02.2019 3:09:00 Error on calling 'OnBarUpdate' method for indicator 'AprorokTEST' on bar 9: Выдано исключение типа "alglib+alglibexception". If, for example, put n = 5 x 2778,5 y 5 i 1 Time 18.02.2019 3:10:00 Error on calling 'OnBarUpdate' method for indicator 'AprorokTEST' on bar 10: Выдано исключение типа "alglib+alglibexception". etc And if you put 2, then everything is fine http://prntscr.com/moytbu |
Author: | Sergey.Bochkanov [ Sat Feb 23, 2019 8:53 am ] |
Post subject: | Re: The problem with the approximation\ alglib+alglibexcepti |
Can you print the value of msg field of alglib.exception object being generated? It contains detailed description of the error. |
Author: | Papercut110 [ Sun Feb 24, 2019 5:04 pm ] |
Post subject: | Re: The problem with the approximation\ alglib+alglibexcepti |
Thanks for the answer, but im not sure I got you right. Have to output this message - APSERVAreDistinct: internal error (not sorted) |
Author: | Sergey.Bochkanov [ Sun Feb 24, 2019 9:09 pm ] |
Post subject: | Re: The problem with the approximation\ alglib+alglibexcepti |
Something is wrong with array x[], it may contain non-distinct values. It is impossible to build spline when some x[i] are duplicates. |
Author: | Papercut110 [ Mon Feb 25, 2019 6:07 am ] |
Post subject: | Re: The problem with the approximation\ alglib+alglibexcepti |
Did I understand you correctly that the values of x should not be repeated? |
Author: | Sergey.Bochkanov [ Mon Feb 25, 2019 8:07 am ] |
Post subject: | Re: The problem with the approximation\ alglib+alglibexcepti |
Yes, you should have unique, non-repeating values in x. The reason is that spline construction with repeating x[] is ill-defined. |
Author: | Papercut110 [ Tue Feb 26, 2019 3:08 am ] |
Post subject: | Re: The problem with the approximation\ alglib+alglibexcepti |
Sergey, thank you very much for your help. Please tell me this feature is inherent in a particular type of approximation or applies to all methods of approximation? Maybe you can suggest some other kind of approximation where duplicate values are allowed, as I approximate a price series in which prices at different time intervals coincide significantly often. |
Author: | Sergey.Bochkanov [ Tue Feb 26, 2019 10:16 am ] |
Post subject: | Re: The problem with the approximation\ alglib+alglibexcepti |
Same principle applies to all interpolation algorithms. However, it does not apply to fitting algorithms (say, one which builds model using artificially regularized grid, and then fit it to the "raw" irregular data). As for ALGLIB, you can use spline1dfitpenalized() (it works for up to several thousands of points) or modified IDW (see http://www.alglib.net/translator/man/manual.csharp.html#unit_idw for more info). I recommend you to start from IDW models because they are better scalable to large datasets. |
Page 1 of 2 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |