Wait, I have it set to zero but the chart interval is minutely. It's not at all updating everytime the price changes. It's updating 200 times when I load it (even when there are only 83 bars), and then it updates on the minute intervals, or when I scroll it.
I will try the display chart timing, that should definitely shed some light on things. So it sounds like if I want to run a back test in a procedural classical way, I would use a static variable, and increment past zero. Then on subsequent updates I would know not to run that portion of the AFL again, is that right? --- In [email protected], Rob Dunbar <sidharth...@...> wrote: > > Conrad... > > Trust me... I know how you feel. I've been there. But once you get a handle > on the way an array language works and the processing cycle, it will al > become crystal clear, and you will understand that you can do in 5 lines of > AFL code what could take you 30 in an event driven language. > > Anyway, under preferences>intraday you have your 'realtime chart refresh > interval' set to zero...?? If so, that DOES NOT mean that your chart doesn't > refresh. That means it refreshes EVERY tick. So it sounds likely that your > chart is indeed refreshing quite regularly. > > Also, under preferences>miscellaneous select "display chart timing"... this > pops up a little white bar at the bottom of each chart which explicitly tells > you how many bars back & forward your chart is using... that should help... > it may be using 200 bars... I don't know... > > > > > ________________________________ > From: Conrad Joach <consolejo...@...> > To: [email protected] > Sent: Thursday, March 26, 2009 9:38:04 PM > Subject: [amibroker] Re: I'm having a very hard time doing something that I > think should be simple > > > Here's what I'm seeing. I have a 5000 bar database, of minute bars. I open a > chart and an AFL that does one thing: > > _TRACE("test" ); > > I don't use printf, I don't know what difference there is between it and > TRACE, but anyway. > > I set the chart interval to hours, which reduces the number of chart bars to > a small number. But my test trace still prints 200 times. > > Why is it printing 200 times for a chart with ~83 bars in it? I have even set > barsrequired prior and forward to 0, and it still prints 200 times. > > And as far as chart refresh events, does clearing the trace window count? > Because if I clear the trace window, it reprints everything 200 times again. > > I also should say again I have my refresh to 0, so no chart refresh should > occur unless I: > > a) load the chart the first time > b) move the scroll bar in the chart > c) a new bar is created because the chart is live > > In the end AB is very different from other backtesting apps. Where you have a > series of bars, and your code is fired once for every bar, no matter how > often you scroll back and forth. If you paint the chart, whatever you painted > is attached in memory to the chart and if you scroll outside of that view, it > dissapears, but the event handler for that bar is never fired again when you > scroll it back into view. > > This is what's driving me batty because I expected it to be just like that. > > --- 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. > > > > > > > > > > > > > > > > > > > >
