Click here to Login




Automatically create historical quotes charts

Updated on 2009-06-20





Chart class

The Chart object is created using the .Net Script; it contains the chart settings and allows you to perform some actions on the pointed chart.
A chart class could be created using the following function Charts.GetSelectedChart(); it orders the application to get a chart object of the currently selected chart.

Open the script editor 'Tools->Script editor' and type the following code to see what variables and functions the chart class exposes:

var chart : Chart = Charts.GetSelectedChart();
chart.




As you can see, you can add a new formula, add a new pane, get the number of quotes, move the chart window, change the symbol name, get the visible start or end dates…

Historical Quotes Charts

Now let us create a script that opens 9 charts to display the historical quotes of some symbols. Here is the code:

var nbcharts : int = 9;
var currentnbcharts : int = Charts.NbCharts;
if(currentnbcharts < (nbcharts))
{
for(var i: int = 0;i<(nbcharts - currentnbcharts);i++)
{
// Get the default chart formula and symbol
var chart : Chart = Charts.OpenChart(null, null, null);
chart.ScrollBarNbQuotes = 10000;
}
}
// Arrange charts
Charts.Arrange();

You can change the 'nbcharts' (number of charts) variable to specify exactly how many charts you want to be displayed in the screen. The 'chart.ScrollBarNbQuotes' variable gets a value of 10000, which means that our charts will display historical quotes of 10000 bars, if enough data is available.
Each chart will show historical quotes that go back to 2002.

To make the charts look better, you can remove the title bar from each one.
To do so, click on View', then select 'All windows style', and finally click on 'Without caption'. This will remove the caption of all visible charts.
You can make the removal of caption permanent for new charts by selecting 'View->Window Style->without caption'.

Automatically create historical quotes charts

Note also that you can specify the number of columns and rows in the last function (Charts.Arrange) and thus you can arrange charts in different ways.











no comments (Log in)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

How to Use the Percentage Scale
Posted 84 days ago

Introduction to the Grid Tool
Posted 183 days ago

QuantShare
Previous Posts

Same chart, different symbols
Posted 2809 days ago

Composite Indicators
Posted 2812 days ago

Example of advanced rule
Posted 2814 days ago

Beta release
Posted 2816 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 © 2017 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.