Click here to Login




Scripting


Scripting

1. Scripting

 

1.1. Introduction


Scripts in the QuantShare software use .Net framework and the Jscript.Net programming language.

.Net Scripts extend QuantShare capabilities and make the application extremely fexible.
Scripts can be shared between QuantShare users.

There are two kinds of scripts, main script and specialized scripts.

The main script allows the user:

·         Control the application behavior

·         Extract databases data

·         Insert, inspect, control and modify database data

·         Control the objects (composites, watch lists, list of rules...)

 

The specialized scripts allow the user to take control over some specific tasks.

The application offers you the possibility to write scripts for the following tasks:

 

Money management: Contains five events, the first and last events happen once while the other events could happen many times during the backtesting.

·         OnStartSimulation: The simulator executes this script before starting the backtesting process.

·         OnNewTrade: The simulator executes this script before entering a new position.

·         OnCloseTrade: The simulator executes this script before exiting a position.

·         OnEndPeriod: The simulator executes this script at the end of each period or bar. (In end of day back-testing, a period is a day)

·         OnEndSimulation: The simulator executes this script when the back-testing process ends.

 

Example: Create a script that initialize an optimizable variable in the 'OnStartSimulation' event

    Create a script, in the 'OnNewTrade' event, that updates the number of shares to buy depending on the trading system drawdown and the optimizable variable defined in the 'OnStartSimulation' event

 

Example: Create a time-series metric for your trading system using the 'OnEndPeriod' and the 'OnEndSimulation' events


Note: In money management scripts, you can define global variables that can be shared between events.

 

List of rules analyzer metrics: Script that let you create metrics to assess rules
Example: Calculate the average performance of a rule for each month.

 

Ranking system analyzer metrics: Script that let you create metrics to assess ranking systems
Example: Calculate the standard deviation of the buckets annual return.

 

Simulation metrics: Script that let you create metrics to assess simulations
Example: Calculate a custom metric that uses Sharpe, Sortino and some others ratios

 

Prediction model metrics: Script that let you create metrics to assess prediction models

Example: Calculate a custom metric that uses others already calculated metrics.

Pre-Parsing data: Script that let you manipulate text or CSV data
Example: Create a new column that is based on others columns data
Example: Update a column data so it can be parsed by the software

 

Post-Parsing data: Script that let you manipulate parsed data just before the application stores it

Example: Correct bad quotes

 

URL-Script: Script that let you dynamically create URLs for the downloader to download. The data is then passed to the Pre-Parsing and Post-Parsing scripts if they are implemented.
Example: Grab the download URL from a website that dynamically change the URL path every day.

 

Functions: Function scripts let you create QuantShare functions. These functions could be used in charting, simulation...

Example: Correct a custom indicator that is not available in the QuantShare indicators list

 

1.2. Script Control

 

.Net script shares the same control; the control is an advanced text box control where you can type in your script.

You can press on CTRL+SPACE at any moment to display the list of functions or variable that you can use in the current script.

Each script contains its own functions and classes.

You can click on the right icon to display information about the current script.

 

 

 

 




Manual

 

Back Parent

 

Download Manual in CHM or PDF format







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.