Click here to Login




Create custom metrics for the statistical data analysis tool

Updated on 2009-07-18





Before reading this post, we suggest you look at our last posts about the Statistical data analysis tool; here are the links to these two posts: Statistical data analysis of time series - Optimization in the statistical data analysis tool

In this post we will show you how to create custom metrics to assess your trading rules and to perform advanced data analysis.
Custom metrics are created using the JScript.Net language, which is part of the .Net framework and is a very easy programming language to learn.

These metrics can be stored, categorized, and shared, which means that even if you don't know how to create them, you can always search, in the QuantShare server, for metrics that other traders have shared.

In the analyzer settings, there is an item called ‘Metrics’; you just need to select it to make the metrics panel appear.



You can create metrics by clicking on the 'New' or 'Add' button. The first one let you create a new metric; while the second let you load a stored metric. For each statistical data analysis you can create as many metrics as you want.
Let us click on 'New' to see how we can create our own item. Clicking on this button makes a new row to appear; click on the green 'circle'.

Here are some important things you need to know about Jscript.Net scripts in the QuantShare application:
- Type CONTROL+SPACE to display the list of available functions and variables.
- On selecting a variable or function from the list box, you will get the description of this item.

Take for example the 'NbPositions' variable; this variable contains the number of positions generated by the analyzer for a specific rule and for a specific output.
Note that the metric script is applied to each combination of rule-output.

To create a metric, we should use the 'Functions' class which contains only one method.
The syntax is very simple; take the following code as an example:
Functions.AddMetric("more than 100", NbPositions > 100);
This code instructs the analyzer to create a metric that display 1 when the number of generated positions exceeds 100. Of course much more complex and useful metrics could be created.

You also need to know about the most important variable, which is 'Positions'.
This variable is an array of objects of type 'SymbolPositionDetails' and it contains the details of all the outputs generated by the statistical data analysis tool. There is a 'SymbolPositionDetails' class for each symbol and each 'SymbolPositionDetails' contains data information only about a particular symbol.
This class contains also an array of objects of type 'PositionDetails'.
Each 'PositionDetails' class has three variables:
Date: The date at which the pattern occured.
NbBars: The position number of bars.
Output: The position output.











no comments (Log in)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

Create Graphs using the Grid Tool
Posted 1400 days ago

Profile Graphs
Posted 1505 days ago

QuantShare
Previous Posts

How to deal with StockTwits data
Posted 5563 days ago

Trend following systems
Posted 5566 days ago

Working with the formula editor
Posted 5568 days ago

Optimization of trading rules
Posted 5579 days ago

Volatility and trading systems
Posted 5581 days ago

Trading Optimization
Posted 5582 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.