Click here to Login

How scripts communicate with each other

Updated on 2009-12-15

The principal role of module's scripts is to provide advanced traders the tools to create whatever they want. These scripts are used by different modules and plug-ins, and as I said, their main use is to extend to capabilities of the application.
The rules analyzer for example has its own script that lets you create custom metrics to assess the analyzer results. Almost, every plug-in has its own script; they all must be written in JScript.Net or c#, two .Net programming languages. C# was added recently and it is currently set as the default programming language.

What about beginner traders and those who don't know how to code?
Let me start with this: the scripts in QuantShare are not mandatory. They surely give you more flexibility and control over your trading process, but they are certainly not critical to your trading success.
The second important thing that I want to point out is that everyone can access and use scripts even those who don't know how to write them. How? Simply, by using the scripts that were shared by other QuantShare members.
If you want to see what "Rules Metric" scripts are available, visit the search page of QuantShare and then select "Rules Metric" as the trading object type. You can then perform your search and download the scripts that interest you. Besides using them, you can also read them and learn how they were implemented.

In this post, I will talk about an important feature introduced recently in QuantShare. This feature or addition allows scripts to communicate among each other simply using shared variables.
A shared variable is an object (variable) that can be accessed by any script within the application. These variables stay alive until the application is closed.
As an example, you can instruct the metric script of the rules analyzer to store the results within a shared variable and then later use the Main Script to create a report (text or html) that displays the results previously created by the metric scripts.
Many problems could be solved using this way of communication between scripts.

To access and create shared variables, there is a class available in all scripts. This class is called "Global" and it contains four methods.
GetVariable: Get a shared variable value
SetVariable: Assign an object to a shared variable
ContainsVariable: Returns whether a shared variable exists
RemoveVariable: Remove a shared variable

Values passed to the "SetVariable" could be of any type, you could pass primitive variables like "double", "int", "string" or structs and classes like lists and dictionaries.
The only thing you should take care of when creating scripts that use shared variables is to make sure there is no conflict between the variable names.

no comments (Log in)

QuantShare Blog
Search Posts

Recent Posts

Create Graphs using the Grid Tool
Posted 1320 days ago

Profile Graphs
Posted 1425 days ago

Previous Posts

How to simulate options strategies
Posted 5333 days ago

Organizing Trading Objects
Posted 5340 days ago

How to search for a download item
Posted 5354 days ago

Trading orders - Part 2
Posted 5361 days ago

Trading Orders - Part 1
Posted 5368 days ago

Sharpe Ratio - Part 2
Posted 5389 days ago

Sharpe Ratio - Part 1
Posted 5395 days ago

The 'inside period' function
Posted 5409 days ago

More Posts


Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2024
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
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.