Event handling in WL5
Author: officetrader
Creation Date: 1/11/2009 11:52 PM
profile picture

officetrader

#1
Hi,

Is there any good reference to learn to add event handlers in WL5?

It seems that there are some technique to learn to add event handlers in overriding functions, because I can't use my workable code with event handlers directly from C# to WL5.
profile picture

Eugene

#2
There is no such reference as far I know, perhaps because the developers didn't consider it to be a use case. A WealthScript program is executed once every bar (the Execute method) in WL4 and WL5 alike.
profile picture

Cone

#3
QUOTE:
A WealthScript program is executed once every bar...
... better to say:
"In a streaming chart, a WealthScript program is executed each time a new bar is added to the chart (at the end of the Bar interval)."
profile picture

Eugene

#4
And again, Aleksey is to demonstrate the creation of events in a WL5 strategy:
CODE:
Please log in to see this code.

However I'm at a loss how can this be used for practical purposes for the aforementioned reason.
profile picture

officetrader

#5
Thanks, it fits my need.
profile picture

Eugene

#6
If that's not a secret, just curious what you're after with the events in WealthScript code?
profile picture

alexkozlinski

#7
Is there information how to intercept WealthLab's form events, e.g. FormClosing event when my strategy chart window is closing?
profile picture

Eugene

#8
Even if you were able to get your hands on the list of open charts through the Application.OpenForms property, it won't help you, because a Wealth-Lab strategy is executed (or public void Execute(), to be precise) only when a complete bar updates (can be 1-minute, 1-day, etc.).