[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Events in AB/AFL - use of www.Amibroker.com/feedback



PureBytes Links

Trading Reference Links

Sorry, but clearly your knowledge about computers is very limited.

In Windows OS, all programs execute strictly sequentially. And all this
"event driven" processing in Windows is actually single big loop 
that calls non-stop GetMessage function and that processes the
message through sequence of conditional statements (either
switch, message crackers, if-else or whatever)

http://www.winprog.org/tutorial/message_loop.html

Thus, in Windows, the whole "event driven" programming is nothing
more than just a big switch that calls appropriate functions.

Frameworks that implement those "event driven" programming do just
that - get the message, then go through big switch/if-else to
determine the message and call appropriate function (i.e. "event handler").

And exactly the same method can be used in AFL.

Nothing stops you from writing all your event handlers are simple
functions and call them depending on what event caused AFL execution.

Exact copy-paste solution is actually included in the User's Manual,
see:
http://www.amibroker.com/guide/afl/afl_view.php?id=297

So, read the fine manual first.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Yofa" <jtoth100@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, March 09, 2009 8:42 PM
Subject: Re: [amibroker] Re: Events in AB/AFL - use of www.Amibroker.com/feedback


> Hi All,
> 
> to clarify what event driven programming model means read this article 
> http://en.wikipedia.org/wiki/Event-driven_programming
> 
> To make it short and simple: the whole AFL code executes as a "single batch" 
> when some event (new tick, time refresh etc.) occures in AB. And then AFL 
> code has to "search for" the event caused the execution.
> In an event driven modell event handler code segments are executed when 
> specific events occure. Usually the programming environment "looks for" 
> events and knows what code fragment (event handler) to execute.
> 
> AFL programming model and the language is not really best suite for this. 
> You can overcome this by writing your own "message loop" in AFL.
> May not be elegent and reliable enough and it is a lot of pain as there is 
> no real debugging support but it works if you use not to small timeframes.
> If you want to do high frequency trading look around for other platforms. 
> Use AB what it is really good for: develop trading strategies.
> 
> Regards,
> 
> Y
> 
> Ps: There is a lot of code out there... Noone wants to rewrite them. AFL is 
> efficient language to process arrays.
> But putting an event driven, broker/exchange interface integrated 
> "execution" module that can access the AFL and charting engines sounds a 
> much better idea.
> 
> --------------------------------------------------
> From: "Dennis Brown" <see3d@xxxxxxxxxxx>
> Sent: Monday, March 09, 2009 5:19 PM
> To: <amibroker@xxxxxxxxxxxxxxx>
> Subject: Re: [amibroker] Re: Events in AB/AFL - use of 
> www.Amibroker.com/feedback
> 
>> Gordon,
>>
>> AFL is event driven.  Some event causes your AFL program to execute.
>> You can check to see which event caused it to run and run all or a
>> portion of your program depending on the event.
>>
>> Check back on your suggestion again for an example of bar closed.
>>
>> You can suggest a new event type that is not already covered if you
>> need one.  However, because the AFL engine is shared between all
>> charts, a particular chart's AFL will have to wait until a currently
>> executing chart is done before the next one can be executed.  So the
>> AFL engine looks for the next chart that has an event only when it is
>> idle.
>>
>> One event that has been suggested before, that would be useful to me
>> as well, is an AFL self programmed event.  This would be some AFL
>> statement that would cause the currently running chart to be put into
>> the queue to be run again as soon as possible --subject to some CPU
>> loading constraints, or after a specified delay less than a second.
>> Currently, if no quotes are coming in, one second is the fastest
>> guaranteed repeat AFL execution.  I have some sequences related to
>> changing parameters that require 4 passes of the AFL to trigger
>> certain conditions that have to happen between AFL passes.  I shut
>> down all but the essential AFL during these sequential passes, but
>> time drags on when you have to wait for one second each pass.
>>
>> Best regards,
>> Dennis
>>
>> On Mar 9, 2009, at 11:50 AM, Gordon wrote:
>>
>>> Hi sidhartha70,
>>>
>>> Thanks for your thoughts. I actually did try something like that,
>>> but seemed to find some sensitive timing issues. My objective was,
>>> as soon as I detected a new bar (this was using one minute bars), to
>>> access information about the just completed bar. At least in my
>>> experience, it was necessary to introduce a delay so that the
>>> Ref(XYZ, -1) function returned information about the bar I was
>>> interested in and not the one before it. In the end, I just felt
>>> uncomfortable that I had an approach I could rely on as being rock
>>> solid.
>>>
>>> I think I'll revisit it, but in the end, would love to be able to
>>> rely on a built-in function. Assuming I'm successful in revisting a
>>> one-off solution, I'll post the results (code).
>>>
>>> The exploration start/stop is a little tougher. One way to do it is
>>> to invoke AA through VBScript, and do your own pre- and post-
>>> processing. Another might be to create ficticious symbols guaranteed
>>> to be the first and last symbols visited by the exploration code and
>>> use the name() function to test for them.
>>>
>>> Regards,
>>>
>>> Gordon
>>>
>>> --- In amibroker@xxxxxxxxxxxxxxx, "sidhartha70" <sidhartha70@xxx>
>>> wrote:
>>>>
>>>> Gordon,
>>>>
>>>> I'm pretty sure you can code for this type of stuff already in AFL.
>>>> You can simply set up your on checks to see if an event has
>>>> occurred, and if it has, execute any code you want...
>>>>
>>>> For example, OnBar() that you are talking about could be achieved
>>>> by looking for a change in DateTime() of the most recent bar...
>>>>
>>>> --- In amibroker@xxxxxxxxxxxxxxx, "Gordon" <gordon@> wrote:
>>>>>
>>>>> Hi All,
>>>>>
>>>>> I just posted a new suggestion at www.Amibroker.com/feedback. It
>>>>> occurred to me that most AB users don't know about or use the
>>>>> feedback area. So, I wanted to take a second to highlight the
>>>>> value of using the site to add suggestions and provide feedback
>>>>> for existing ones. If you haven't gone there (you need to be a
>>>>> registered AB user), there are tons of neat suggestions.
>>>>>
>>>>> My second reason for posting is, I'm curious to know how many
>>>>> would find the addition event-based AFL coding useful -- e.g.
>>>>> functions you write that would be executed automatically upon the
>>>>> occurrence of specific events, such as the current bar jused
>>>>> completed (geared toward tick and other intra-day charts),
>>>>> backtester started, exploration finished, etc.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Gordon
>>>>>
>>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------
>>>
>>> **** 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
>>>
>>>
>>>
>>
>>
>>
>> ------------------------------------
>>
>> **** 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
>>
>>
>>
>> 
> 
> 
> ------------------------------------
> 
> **** 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
> 
> 
> 


------------------------------------

**** 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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/