Click here to Login




Chart Layouts Explained - With Custom Scripts

Updated on 2021-06-01





Chart layouts contain information such as the number of panes, the formula(s) as well as the template that is applied by each pane.


How to create a layout?

To create a layout from a chart, right click on that chart, then select "Save layout as...". Type the name for your layout then save.


How to apply a layout?

To update a chart layout, right click on a chart, select "Change Layout" then select the layout you want to apply.
You can also apply a layout to all opened charts by clicking on the button as shown in the picture below then selecting the appropriate layout.




You can also switch from one layout to another using the CONTROL+ALT+L hotkey


Custom Scripts?

The previous hotkey we introduced allows you to move from one layout to the next one. But how to access the previous layout instead of the next one?

There is no hotkey for this so we are going to create our own hotkey to do that.
You can create a custom script and assigns a shortcut to it with the "Add Shortcut" feature that you can find after selecting "Divers -> List of shortcuts" at the bottom of Alchemcharts.

The script should be created using "Tools -> Script Editor".

Here is an example:

if(!Global.ContainsVariable("layout_index"))
{
Global.SetVariable("layout_index", 0);
}
int index = (int)Global.GetVariable("layout_index");
string[] layouts = App.Main.GetLayoutNames();
App.Main.UpdateChartLayout(Charts.GetSelectedChartId(), layouts[index]);
index = index - 1;
if(index < 0)
{
index = layouts.Length - 1;
}
Global.SetVariable("layout_index", index);



The idea here is to check the value of the global variable "layout_index" (that we define).
Then, we get the list of all layouts, pick the layout given the "layout_index" then subtract one to "layout_index", so that the next time the script is called we will get the previous layout.

After you create the script, select "File -> Save As..." then save it under the "Scripts" folder.
Now, at the bottom of QuantShare, click on the "Divers" icon then "List of Shortcuts".
In the new form, click on "Add Shortcut".




Type the name of the shortcut, a description, how to activate it then finally enter the script path.
If you named the script "prev_layout" then you should enter there: Scripts\prev_layout.azf




Automation Ideas?

There are several ways we can use the layout tool. And when combined with custom scripts capabilities, we can further create advanced and creative stuff.

Below are some examples of what you can achieve:

Update Chart Layout based on Active Time Frame:
In this post, we show you how to change the layout of a chart dynamically based on the current chart time frame.

Update Chart Layout based on Active Ticker Symbol:
In this post, we show you how to change the layout of a chart dynamically based on the current chart symbol.
For example, you can display the RSI on the lower pane for stocks and when switching to an index display a market breadth indicator.

Update Chart Layout based on Active Ticker Symbol - Part 2:
This is the second part of the previous blog post. Here, we explain how to associate a specific layout to a list of symbols so that a specific layout is applied to a chart each time a symbol in a specific list is selected.












no comments (Log in)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

Create Graphs using the Grid Tool
Posted 1438 days ago

Profile Graphs
Posted 1543 days ago

Lock, Link and Undock your Charts
Posted 2353 days ago

How to Use the Percentage Scale
Posted 2902 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.