Thanks for that snippet. That actually is cleaner than what I ended up doing.
I'm getting there, baby steps :) --- In [email protected], "Tomasz Janeczko" <gro...@...> wrote: > > I wrote previously: > "you should NOT really make ANY assumptions as to when charts will refresh as > it can happen > literally anytime, with chart zoom, resize, scroll, change ticker, > interpretation display, data window diplay, > commentary, forced programmatic refresh, etc." > > If you want your code to execute ONLY in certain intervals you should use > > RequestTimedRefresh( 20 ); // every 20 seconds > if( Status("redrawaction") ) > { > // PUT YOUR CODE ONLY HERE > } > > > The part in braces will execute only every 20 seconds. > > Best regards, > Tomasz Janeczko > amibroker.com > ----- Original Message ----- > From: "Conrad Joach" <consolejo...@...> > To: <[email protected]> > Sent: Sunday, March 29, 2009 10:59 PM > Subject: [amibroker] Re: Ok now this is just crazy > > > > Because it is absolutely critical to fully understand the circumstances > > that cause your code to be invoked and what your code can > > expect to see when it is invoked. > > > > The example I gave in this thread is borderline insane, because think about > > it, your code is attached to one chart pane, and yet > > it is invoked twice every second. But only if a user clicks inside your > > chart pane. And then if it is invoked twice, the first > > time it will see a view from *the top chart pane*. > > > > That means that the number of visible bars will return *different* than the > > number of visible bars for which the user actually > > applied your code to. > > > > That makes debugging your code an absolutely head banging task, because you > > can't understand why your code is reporting one thing > > when clearly the pane it was applied to has a known set of state to you. > > > > Any system that wants to be used with real money has to explain in total > > detail these basic things. > > > > Maybe these facts are not relevant to most people here, so be it. But if > > I'm to end up spending hundreds of hours building a > > system and then thousands of dollars to buy the number of AmiBroker > > licenses that I would need to deploy in my firm, I want to > > know exactly what I'm dealing with up front. > > > > --- In [email protected], "sidhartha70" <sidhartha70@> wrote: > >> > >> Conrad, why are you so obsessed with the minutiae of AB's calls to > >> different chart panes...?? > >> > >> How is that going to help you...? I get the feeling you are looking at AFL > >> like an event driven language... > >> > >> --- In [email protected], "Conrad Joach" <consolejoker@> wrote: > >> > > >> > Maybe I'm the only person in the world having a hard time getting grips > >> > on how AmiBroker actually works. I'm about to give up > >> > because I just can't get a strong understanding of these basic things. > >> > And yes I've submitted this to support but it's the > >> > weekend and I'm wasting hours on this. > >> > > >> > Do the following and tell me what you see. > >> > > >> > 1) Create a new blank chart with minutely interval. Add a Price series > >> > on it. Make sure that your chart refreshes are set to > >> > once per second (1) in the Intraday tab in Preferences. > >> > > >> > 2) Using the following AFL script, create a 2nd chart pane and add the > >> > AFL below. > >> > > >> > Script: _TRACE(NumToStr(NOW(4))); > >> > > >> > 3) Now click inside the pane that has the AFL from below. Notice that > >> > every time its invoked, its invoked twice? Look at the > >> > seconds part of the time, there are two printouts per second in the > >> > trace window, and one value is for the top pane, and the > >> > other value is for the bottom pane. > >> > > >> > 4) Now click in the top pane (not where the AFL is applied to), you'll > >> > see it goes back to printing just once per second. > >> > > >> > Why is this happening? If I create a 2nd pane in a chart window, and add > >> > AFL to it, why on earth would it be called twice when > >> > I click *inside* the pane and once when I click outside the pane? > >> > > >> > Am I wrong or shouldn't it only be called once per chart update > >> > interval, not twice? And to make matters worse, when it is > >> > called for the top chart pane (not the one we applied it to) it will > >> > receive a very different view of the state of AmiBroker. > >> > Things like number of visible bars may be different than the bottom pane. > >> > > >> > > > > > > > > > > ------------------------------------ > > > > **** IMPORTANT PLEASE READ **** > > 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/ > > > > Yahoo! Groups Links > > > > > > >
