×

Sign up and get MultiCharts free

Use its powerful simulation mode with data included out of the box. Just fill out the form and start honing your trading skills with a few clicks.

Changes - MultiCharts
Open main menu

Changes

Beginner's Guide to MultiCharts Programming

747 bytes added, 16:24, 26 January 2022
m
no edit summary
This article highlights some PowerLanguage formatting tips, as discussed in a forum topic <ref>[http://www.multicharts.com/discussion/viewtopic.php?f=1&t=9792 MC Programing - What I’ve learned]</ref>.
== Layout ==
Some tips regarding the layout of a coding script.
 
=== General layout tips ===
Some general layout tips are:
 
* Use tabs and empty lines to make the code better readable - don't forget: if you want to edit your script a half-year from now, you'll still need to be able to comprehend it.
* Make use of comments.
* While it isn't needed in EasyLanguage to use parentheses ( & ) after an 'if' statement, it makes the code better readable and prevents errors.
* Make your code explicit. For example, instead of writing ''if LastBarOnChart then'' write ''if (LastBarOnChart = True) then''. While both statements work, the latter makes it easier to debug and makes the implicit assumptions you're making explicit.
=== Description ===
==== Other Input formatting suggestions ====
* Start[[IntraBarPersist]] variables with a captial letter (e.g. ''MyDefinedVariable'') and start regular variables with a normal letter (e.g. ''myDefinedVariable''). This helps to keep track of which variables are regular and which ones are IntraBarPersist.
== If else statements ==
When writing [[Comparisons_and_Loops:Category:Comparisons and Loops|if else If Else statements]] the use of '''tabs''' are is highly recommendrecommended.
Some examples of poor formatting would be:
== References ==
<references />You can find useful information about Power Language coding [[Additional Information Sources | here]].