PDA

View Full Version : Function parameters won't work correctly



erosergun
06-03-2011, 05:10 PM
Hi eveyone,

My question seems to be unique, so far I have failed to find a solution.

I call a function from an Excel sheet which gets live data from a stock server. My Function parameters are bid, ask, number of shares sold, number of shares bought, and several other relevant data. The thing here is that, for a function to run, just a single change in any of these parameters is sufficient. However, I need to make sure that, before my function runs, all relevant data to be updated first for each transaction. Therefore, the function does not work as I expect it to do. For verification purposes I am trying to count no of shares bought and sold in a day but my function misses up to 40 % of transactions. It must be called eventhough not all the parameters are updated for a complete transaction and hence results in erroneous output.

Is there anyone who faced the same problem and, more importantly, has a solution? The Excel sheet is updated from the server dozens of times a second for several stocks. Eventhough I try it with just one share, the failure ratio is as much as 40%.

Many thanks in advance.

mikerickson
06-03-2011, 06:20 PM
Have you looked at Application.Volatile?

GTO
06-03-2011, 06:50 PM
Cross-posted: http://www.mrexcel.com/forum/showthread.php?t=554841

erosergun
06-03-2011, 07:40 PM
Yes,

Application. Volatile does exactly what I don't want.

I am trying to find a way to call my function when all inter-related parameters are properly updated from live-data server, not before, not in the middle, just when the update if finished. Otherwise, my function returns incorrect results.