How to use indicator with default indicator properties
To use this indicator it’s needed to add it to each newly opened chart. To avoid adding it to chart manually you should automate this process. For that open new and clean chart you want and add this indicator to it. Then it’s needed to save template of this chart to default template. It allows for MT4 terminal to apply this default template to each newly opened chart. To do this make a right click on the chart and select “Template” from context menu. Then click “Save Template…” item.
Save template with “Default.tpl” file name at default ‘template’ folder like it’s shown below.
That’s it. All configurations is done. Now you can open any chart and make some changes. Then press ‘S’ button to save chart’s sate. At next time when you will one this chart again the state of chart will be loaded automatically. Or you can press ‘L’ button to load last saved state of chart.
How to use indicator with multiple instances of MT4
First of all it’s needed to create folder where will be stored states of charts. For example, the folder “C:\ChartsStates” will be used. Then it’s needed to create symlinks to that folder from both instances of MT4. For that it’s needed to know default paths to templates folders MT4s. Go to “File” menu at MT4 and click on “Open Data Folder”.
Data Folder will be opened. There is a “templates” folder there. Save path to this templates folder. Then open default “Command Prompt” of windows. Press windows button and start typing “Command Prompt”.
To create a symlink at MT4 execute this command at Command Prompt by using your template path which was got at previous step:
mklink /D "C:\Users\Nomad\AppData\Roaming\MetaQuotes\Terminal\A1660DA4CB596E740BE3B3233E577E1B\templates\ChartsStates" "C:\ChartsStates"
Create symlink to “C:\ChartsStates” for the second instance of MT4 by the same way. Then after all symlinks was created it’s needed to configure MT4s to use this folder. For that do the same steps as described at “How to use indicator with default indicator properties” section. But in this case value of indicator property “Templates sub folder” should be changed to “ChartsStates“. Do this for both MT4s.
Indicator Parameters Description
|Parameter Name||Type||Default Value||Description|
|Log level||LogLevel||LogLevel::Error||Identify which log level will be printed.
LogLevel ::Trace – Print Trace, Info, Warning, Error and Critical messages;
|Hotkey for saving of a chart state||Keys||Keys::KEY_S_83||Hotkey on your keyboard which saves current chart state by pressing it. You can choose almost any key of keyboard from list. Value of key has such kind of view “KEY_[Key Name]_[Key Code]”.
[Key Name] – Name of key on keyboard;
|Hotkey for forced loading of a chart state||Keys||Keys::KEY_L_76||Hotkey on your keyboard which loads previous state of your currently opened chart by pressing it. You can choose almost any key of keyboard from list. Value of key has such kind of view “KEY_[Key Name]_[Key Code]”.
[Key Name] – Name of key on keyboard;
|[Templates sub folder] Description 1||string||description||Description message. Has no effects to indicator working.|
|[Templates sub folder] Description 2||string||description||Description message. Has no effects to indicator working.|
|[Templates sub folder] Description 3||string||description||Description message. Has no effects to indicator working.|
|Templates sub folder||string||empty||Sub folder path where is stored charts’ states files. It can be empty. In that case charts’ states files will be stored at root ‘MT4\DataFolder\templates’ folder of MT4. By limitation of MQL sub folder can’t be created programmatically. Thus if you do not want to keep value of this property by default you have to pre create sub folder manually. To do this go to “File” menu at MT4 and click on “Open Data Folder”.
“Data Folder” of your MT4 is opened by File Explorer. Data Folder path looks about this: “C:\Users\[YourUserName]\AppData\Roaming\MetaQuotes\Terminal\08FEDC217FAC472 7AD3352D7E43C180B\templates”. Go to “templates” folder and create there sub folder you wish to store charts’ states files. For example if create sub folder with name “SharedChartsStates” then this indicator property should be set to ” SharedChartsStates“. If you want to create sub folder at sub folder you should use ‘\’ separator at this property. For example “SharedChartsStates\GlobalStates”.
|Autoload previous chart state||bool||true||If this property is set to true then each newly opened chart is automatically loaded its previous state. Otherwise you have to load previous chart’s state manually by pressing hotkey. You can identify hotkey from ‘Hotkey for forced loading of a chart state‘ property.|
Link to Chart State Saver for MT4 at MQL market: https://www.mql5.com/en/market/product/61673
Link to Chart State Saver for MT5 at MQL market: https://www.mql5.com/en/market/product/62035
Join Take profit Telegram channel to get latest news and updates.