What constitutes a refresh is the entire chart redrawing... you see, you are still thinking 'bars'... stop thinking 'bars' and start thinking 'arrays of bars'...
________________________________ From: Conrad Joach <[email protected]> To: [email protected] Sent: Thursday, March 26, 2009 9:41:11 PM Subject: [amibroker] Re: I'm having a very hard time doing something that I think should be simple But what constitutes a refresh? Let me ask you this, the first time you load a chart with 100 bars, 10 visible, will each of the 10 visible bars being drawn constitute a refresh? Or is the act of showing the chart and loading it the first time counting as one refresh? --- In amibro...@yahoogrou ps.com, "sidhartha70" <sidhartha70@ ...> wrote: > > The best way to look at it is this... > > Every time your chart refreshes, the entirety of your AFL code is executed > from top to bottom linearly. However, ALL array operations will work on the > entire price array in one line of code... however, all looping operations > will operated iteratively a per a normal linear programming language. > > > --- In amibro...@yahoogrou ps.com, "sidhartha70" <sidhartha70@ > wrote: > > > > Conrad... your code, for example Printf("Test" ); will execute every time > > the AFL executes, and that is done on each chart refresh... for each chart. > > > > Effectively a chart refresh 'event' causes your AFL to execute. > > That's why you get many 'test's in the trace window. > > Now, if you have a 5,000 bar DB, AFL will only execute over the bars it > > needs to which is either defined by the user using SetBarsRequired( ) or by > > AB automatically. This reduced number of bars that are refreshed is called > > 'quick AFL'. > > > > --- In amibro...@yahoogrou ps.com, "Conrad Joach" <consolejoker@ > wrote: > > > > > > Agree, I'm not fully grasping the catalysts. > > > > > > Frankly I'm more of a fan of an event driven system. You override events, > > > and you can look at the time series from any event, and each event is > > > obviously fired once per bar. > > > > > > This just has my head spinning, and I've been coding for a decade and a > > > half. It just doesn't feel natural to me and the lack of clarity on the > > > behavior of the trace window is making it very hard for me to debug. > > > > > > If I print out the word "test", why does it show up 200 times on a 5000 > > > bar chart? Can anyone answer this? > > > > > > --- In amibro...@yahoogrou ps.com, Snoopy <snoopy.pa30@ > wrote: > > > > > > > > Conrad, > > > > > > > > I am a newbie as well, so I might be way off base, and expect more > > > > experienced folks to set us straight... > > > > > > > > I think you (and I) have not fully grasped the ARRAY Processing > > > > methodology of AFL. > > > > > > > > Try thinking of it as if you are using Excel - and you paste a formula > > > > into an entire ROW. > > > > When you finish the paste, it does the calculation. > > > > > > > > You (and I) need to better understand what triggers the running of the > > > > AFL (I assume a new data bar will trigger it - not sure when - start, > > > > or > > > > complete). > > > > > > > > And for your benefit, you could also use the afl functions for First > > > > Visible Bar and Last Visible Bar. > > > > > > > > I hope this helps. > > > > > > > > Snoopy > > > > > > > > Conrad Joach wrote: > > > > > > > > > > I'm just not understanding the way AB is evaluating AFL for a chart. > > > > > Let me break it down. > > > > > > > > > > Let's say I have a database with 100 1 minute bars, 100 minutes of > > > > > quotes. > > > > > > > > > > Now let's say I have a chart, and that chart is very narrow and only > > > > > shows 10 bars worth of data. > > > > > > > > > > I write an AFL sript. I want to do a very simple thing. > > > > > > > > > > For every bar in the series of 100, I want to check if it's visible > > > > > (meaning it's inside the 10 bar window that is viewable in the > > > > > chart), > > > > > I want to print the date and time of that bar. For this example let's > > > > > say the chart is positioned at the end, showing bar 91-100. > > > > > > > > > > The script should send the date and time of bars 91-100 to the trace > > > > > window. As far as I'm concerned there should only be *10* lines in > > > > > the > > > > > trace window, no more, no less. I guess this means setting the > > > > > forward > > > > > bar padding to 0, and the prior bars to 0. > > > > > > > > > > But here's the catch. These 100 bars are history. As soon as its > > > > > loaded, bar 101 comes in across the wire. The script should only run > > > > > *once* for bar 101. > > > > > > > > > > This is the paradigm I'm used to seeing in almost every other > > > > > backtesting system. I don't want my AFL script to run 10 times for > > > > > bars 92-101 when that 101st bar crosses the wire. I just want the > > > > > last > > > > > bar evaluated, and the ability to look back at prior bars. > > > > > > > > > > Where am I going wrong? Many thanks for any help you can provide. > > > > > > > > > > > > > > > > > > > >
