Click here to Login




Custom Shortcuts - Move a Chart to Display the Last Quotes/Data

Updated on 2013-12-10





In our previous version of QuantShare, we have released a new feature that lets you create custom shortcuts. The idea is to associate a specific shortcut with a QuantShare script. Since scripts can do almost anything on QuantShare, you can define a shortcut to perform any imaginable task.


How to Move a Chart to Show the Last Quotes?

This can be accomplished using the script editor of QuantShare.

- Select "Tools" then "Script Editor"
- Select "File" then add a new script. Name it "LastQuotes".
- Type the following formula to reference the selected chart then moving the scroll bar to show the last quote.

Charts.GetSelectedChart().ScrollBarIndex = 100000000;

- Once done, save the script and click on "Execute" to see how the scroll bar is moved on the selected chart. For this to work, make sure that the last bar is currently not shown on the selected chart.


How to Create a Custom Shortcut?

At the bottom of QuantShare, click on "Divers" button then "List of Shortcuts".

This form displays built-in and custom shortcuts.

For example, a built-in shortcut would be the "CONTROL+ALT+L" to switch between chart layouts.

To create a new custom shortcut, click on the "Add Shortcut" at the bottom.

Fill the following fields:

Name: The name of the shortcut. Example: LastQuotes.
Description: A description that tells you what the shortcut does.

Activation: Specify how to activate the shortcut. Example: check "CONTROL" and type "L" next to "Key".
Path: Specify the script to execute when the shortcut is activated.
Example: Scripts\LastQuotes.azf

This is the location of the script we have created previously. Remember I told you to name it "LastQuotes".

Click on "Save" to save your shortcut.

Note that in order to update a shortcut, you just need to create a new shortcut with the same name.




Testing The Shortcut

Now, let us test our new shortcut on a chart.

Select a chart then move the bottom scroll bar so that it doesn't show the last bar.
Guess what happens when you click on "CONTROL+L"?


Show Last Bar For All Charts

Let us imagine you want to display the last bar not only for the selected chart but for all charts.

Just keep the same shortcut, open your "LastQuotes" script then update its formula to:

Chart[] charts = Charts.GetAllCharts();
for(int i=0;i < charts.Length;i++)
{
charts[i].ScrollBarIndex = 100000000;
}













6 comments (Log in)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

Create Graphs using the Grid Tool
Posted 1427 days ago

Profile Graphs
Posted 1532 days ago

QuantShare
Previous Posts

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.