Click here to Login




Introduction to the Events Monitor Tool

Updated on 2017-11-16





The "Events Monitor" is a new tool recently introducted in QuantShare. It allows you to monitor and catch different QuantShare events and generate alerts, execute scripts, send emails... based on these events.

Currently we support the following events:
Symbol: Generated when a change happens to a ticker symbol (new data, information, new drawing...)
NewTick: Generated on a new real time tick
NewBar: Generated on a new real time bar
MarketDepth: Generated when market depth changes for the analyzed security
OrderStatus: Generated when an order status changes
Alert: Generated when a new alert is triggered

Note: All events except the first one are supported only in the real time version of QuantShare.

More events will be added in newer versions. Please also note that you can use the script editor (Tools -> Script Editor) to create custom events. We will discuss how to do that in the end of this article.


How to Monitor Events

To start monitoring events, select "Tools" then "Events Monitor". This will bring a new form where you can select the events to display by clicking on the "All Events" button at the bottom. By default, all the events are displayed.

At any moment, you can check the "Freeze" check box to stop updating the list.

Each event comes with some attributes that are displayed in the "Values" column. The content or value of each attribute is displayed only if it is a numeric or text value. You will see something like "String[]" if the value is an array. In that case, you can access the different elements of the array using the Global script. More about this later in this article.




How to Create an Alert based on an Event

To create an alert for a specific event, click on the the "Create Alert" button at the bottom of the "Events Monitor" form.

Name: Type here the name of the event
Conditions: Specify the conditions that must be meet in order to trigger the Alert.
All conditions must be met in order to trigger the alert.
For each condition, you must first specify the event name, the field or attribute to check (You can see the different attributes in the "Events Monitor" under the "Values" column), the operation (Contains or equals to) and then the "Value" that must be checked.
Happens within...: Specify the maximum number of seconds that separate the first and the last condition
Notification: Select here how you want to be notified when the alert is triggered
General Event: This allows you to generate a custom event when the alert is triggered

As an example, in order to create an alert when you draw something on the GOOG chart, you need to create two conditions:

Condition 1
Event Name: Symbol
Field: symbols
Operation: Contains
Value: GOOG

Condition 2
Event Name: Symbol
Field: type
Operation: Equals to
Value: Drawing



Using the Script Editor to Catch Events

Open "Tools -> Script Editor" to create a global script. The global script allows you to control almost everything in QuantShare. When it comes to events, you can access the following two functions:

Order.SendEvent: Send a custom event
Order.SubscribeEvent: Subscribe to an event


Example 1:
// Generates a new event called "Hello" that has two attributes (Type and Value).
Hashtable h = new Hashtable();
h.Add("Type", "message");
h.Add("Value", 1);
Global.SendEvent("Hello", h);


Example 2:
// Display the message "Test" when the event "Hello" is received
Global.SubscribeEvent("Hello", Receive);

while(true) // Keep the script alive so that we can catch the "Hello" event
{
App.Main.Sleep(1000);
}

#functions#
public void Receive(EventManager m, SubscribeThreadEventArgs e)
{
MessageBox.Show("Test");
}


To test the above examples, create two scripts with the code in the example one and two then select the "Example 2" script, select "Settings -> Add current script to bookmark panel".
Execute the script from the bookmark panel then select "Example 1" and execute it directly from the script editor by clicking on the "Execute" button in the toolbar.

More information about the bookmark panel can be found here.

Note that you can access the event attributes using the "e" variable of type SubsribeThreadEventArgs.
That variable contains the following methods and properties:
e.Event.GetElements()
e.Event.GetNumeric(string attribute)
e.Event.GetValue(string attribute)
e.Event.Name
e.Event.Timestamp













no comments (Log in)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

Create Graphs using the Grid Tool
Posted 1407 days ago

Profile Graphs
Posted 1512 days ago

QuantShare
Previous Posts

How to Use the Percentage Scale
Posted 2871 days ago

Introduction to the Grid Tool
Posted 2970 days ago

Trading the Strategy Equity Curve
Posted 3107 days ago


More Posts

Back







QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.