Changes

Jump to navigation Jump to search

Language Elements

110 bytes removed, 16:52, 18 November 2020
m
no edit summary
Implementing trading strategies in PowerLanguage requires familiarity with the basic rules and structure of the language, outlined below, as well as with the keywords described in the keyword section of this reference guide.
<br><br>'''==PowerLanguage Studies and Statements'''==
A complete PowerLanguage "program" is called a '''Script'''. An example of a script would be a Strategy, a study that issues trading orders, an Indicator, a study that draws plots on a chart to assist in making trading decisions, or a Function, an independent procedure (subroutine) that can be called from another script to carry out a specific task.
Statements are evaluated from left to right, and scripts are evaluated from top to bottom.
<br><br>'''==Price Charts'''==
A data series consists of groups of price data points, based on a defined interval and arranged in a chronological order.
Both time and price in the above statement are referenced in terms of bars.
<br><br>'''==Price Chart Evaluation by PowerLanguage Studies'''==
A PowerLanguage script evaluates a chart on bar-by-bar basis, starting with the very first (oldest) bar on the chart. The exact same script is executed for every bar.
A more detailed description of how a chart is evaluated is presented in the [[How_Scripts_Work|How Scripts Work]] section.
<br><br>'''==PowerLanguage'''==
PowerLanguage allows a combination of keywords, constants, variables, mathematical and logical operators, and punctuation to be used to express trading rules and bring about both conditional as well as unconditional actions and output.
Each category of PowerLanguge components is discussed below:
<br><br>'''==Keywords'''==
Most of the keywords are the instructions, "action words", of PowerLanguage.
A list of keywords with detailed descriptions and examples is available in the [[:Category:PowerLanguageKeywords|Keyword Reference]]
<br><br>'''==Skip Words'''==
Skip words are the interjections of PowerLanguage. They actually do nothing, and are skipped during code execution, but they make PowerLanguage easier to read.
In PowerLanguage Editor, skip words appear in red. A list of these words is available in the [[:Category:Skip_Words|Skip Words]] section of this guide.
<br><br>'''==Operators'''==
There are four types of operators: Mathematical, Relational, Logical, and String.
"String expression one and string expression two"
<br><br>'''==Referencing previous bars'''==
Previous bars' values can be referenced by using the statement <code>N Bars Ago</code>, or by using the bar offset notation that consists of a numerical expression enclosed in square brackets:
<code>High [2]</code>
<br><br>'''==Time and Date'''==
Time values in PowerLanguage are specified in the 24-hour HHmm or HHmmss formats, where 1300 = 1:00 PM and 130000 = 1:00:00 PM, respectively.
This format is also known as the "EL Date" format.
<br><br>'''==Variables'''==
Variables are used to store numerical, string, or logical (true/false) values. The value stored in a variable can be referenced throughout a script by the variable’s name, and can be modified by the script at any time. Variables must be declared before use.
For more information see [[Variable]]
<br><br>'''==Arrays'''==
Arrays are multiple-element variables.

Navigation menu