Tomasz, thank you very much for your reply, additional information and useful links.
The real problem in my case has nothing to do with Param() function - I used Param() as an example. Thanks to your and fxshrat's explanations, now I know, that using Param() to illustrate my problem with Code Check & Profile wasn't a good choice. I will try to produce this problem in another way as it is difficult to present the real code because of the way it works and the data it uses.
The reason I wrote this post is the fact, that I have been working on a rather complex indicator - a kind of a simplified implementation of Market Delta in Amibroker. I also collect my own Bid/Ask data from the plugin. Bid/Ask data (Bid/Ask volume, number of Bid/Ask transactions - per bar, per each transaction and per each price level) is stored using Persistent StaticVars. The indicator (which makes the Code Check & Profile show inappropriate readings), uses data from StaticVars not from the regular data base. When using Code Check & Profile I am getting strange information. For example Code Check & Profile shows that StaticVarGet() and SumSince() were used 65 times, whereas I have checked, that these functions were used only (for example) 18 times. I was wondering, what might be the reason. At the beginning I thought, that it must be my fault, but then I have checked it many times and come to the conclusion, that in this case I am right and the Code Check & Profile is wrong. StaticVarget() and SumSince() were used only 18, not 65 times.
StaticVarGet() and SumSince() are used inside a loop, which number of iterations depends on some conditions (usually it is the difference in points between LLV and HHV of a future contract in a selected range). The range(s) selection is done (so far) by using BeginValue(), SelectedValue() and Endvalue(). I have used _TRACE to check how many times the loop is repeated (and how many times are these statements executed) in particular situations and I know I am right. Besides I have measured the execution time using GetPerformanceCounter() and it confirmed my observations. Code Check & Profile indicates using a constant (and large) number of StaticVarGet() and SumSince() no matter what range I select. In fact the number of loop iterations and execution times differs and clearly depends on a selected range. The bigger/wider the selection the more times they are executed. _Trace and GetPerformanceCounter() timings confirm that relation.
My problems probably/maybe have something to do with the fact that some parts of my code are executed conditionally depending on SelectedValue(), BeginValue() and EndValue() current values. Besides I use lots of ValueWhen(). Or maybe they are caused by using data from the Persistent StaticVars instead of the data from the database. Maybe it is just the complexity of the formula ...
All in all, the indicators (the one that collects the data and the second one which displays the results) work quite well. Especially if we take into account, that the formula gathering data is refreshed up to 10 times per second. But sometimes lets say once a day (or once every few days) I get an Exception. I am trying to find a reason what causes these rare exceptions.
Regards
Posted by: milosz.mazurkiewicz@yahoo.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (12) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon