Using the Code Block Feature
The Code Block features allows you to create a code block within an MQL file that will not be overwritten by the VTS code generator.
This allows you to make manual edits to your MQL code using the MetaEditor without your code be overwritten when the system in re-built inside of VTS.
To create a Code Block:
- Configure the new MQL Element by clicking the (i) button:
- Check the Treat as Code Block checkbox. this will:
- Set the editor to read-only so the MQL code can not be changed inside of VTS
- Show the tag used to find and identify the code block inside of the MQL file
- Save and Build the VTS System
- Open the MetaEditor (inside of VTS by clicking the Editor button, or outside of VTS via your MetaTrader platform)
- Find the START and END sections of the code block. For example:
- CODE_BLOCK_MQL2_ START
- CODE_BLOCK_MQL_2_END
- Any MQL code added between these tags it will not be overwritten by the VTS code generator:
- VTS will search the MQL file for code block tags, save the code to the MQL Element and continue.
- At any time the Treat as Code Block checkbox may be unchecked and the code from the MQL Element inside of VTS will be used instead of the code within the code block of the MQL file. Note: All changes in the MQL file will be lost.