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; }
|