PL language is an easy interpreted language for writing strategies. It is a simplified Lisp model language that is written with its elements separated by white space, and surrounded by parentheses.
In MT4-Progress you don’t need to use it as it is generated by the graphical editor.
There is a complete mirroring between the Graphic Editor and the PL Editor.
The language is composed of functions and values.
- Function :
The syntax of a function is :
(function par1 par2 par3 …)
where par1 is either a value or a function.
- Value :
A value is either a variable or a type value or a constant.
An example of a strategy written in PL :
Let’s examine the syntax of the expression above
The first expression is (IF par1 par2 par3) where in the IF function we have
par1 : (AND par11 par12) // AND logical function returning true or false
par2 : (BUY) // function
par3 : (START) // function
in (AND par111 par112) we have
par111 : (AndBS UPFRACTAL S_ABOVE P_H4) // ANDBS logical function on indicators
par112 : (AndPS HIGH S_UP P_H4) // ANDPS logical function on indicators
AndBS function is the AND Period Logic operation for the signal S_ABOVE occuring on the Object UPFRACTAL for a Bar of the period H4 and not occuring on the previous bar. Returns true/false.
So here simply it returns true if the price is above the UPFRACTAL of the period H4 on only the first bar.
On the next other bars even if the price is above the UPFRACTAL it returns false.
We use this function when we want the beginning of the signal and we don’t want to get in late.
AndPS returns true if the previous HIGH is UP (means higher high)
Complete Strategy written in PL Language