Code Snippet (MQL Function)
- Selecting the configuration (+) button of an MQL function Element will display the MQL Function Configuration Window.
- There is a single tab on the MQL Function Configuration Window, the MQL Tab.
- The MQL Tab is used to edit native MQL code.
- VTS automatically determines if an MQL Element is a Code Snippet or a Prototyped Function when the MQLElement is saved.
- If the first uncommented line of code contains a correctly formed function prototype, the Element will be saved as a Prototyped Function. Otherwise the Element will be saved as a Code Snippet.
- A Code Snippet can be any valid MQL code.
This example uses the MQL platform functionPrint :
Print("Hello world!");
This example uses a previously defined VTS Variable to assign a mathematical expression:
myprice = (Bid - Ask)/2;
- NOTE: Knowledge of MQL is required to create MQL Elements. Syntax errors can be injected into the trading system if care is not taking when using native MQL to create MQL Elements.