Program Structure

You are here:
< All Topics

VAI Script Code needs to be written in a single line. The following script is the correct structure

Set Buy = LAST > OPEN OR  VOLUME > REF(VOLUME, 1) * 2

This is the incorrect way or writing VAI code:

Set Buy = LAST > OPEN OR 
VOLUME > REF(VOLUME, 1) * 2

Some of the examples in our knowledge base might be written in broken lines for easier reading.

It is good practice to structure your scripts to make them as intuitive as possible for future reference. In some cases it may be useful to add comments to a very complex script. A comment is used to include explanatory remarks in a script. 

Whenever the pound # or a double slash // sign is placed at the beginning of a line, the script will ignore the words that follow. The words will only serve as a comment or note to make the script more understandable:

//Evaluates to true when the last price is higher than the open or the 
# Volume is 2 X’s the previous volume: 

Set Buy = LAST > OPEN OR VOLUME > REF(VOLUME, 1) * 2 

The script runs just as it did before with the only difference being that you can more easily understand the design and purpose of the script.

Previous Functions
Next Plotting Trading Signals
Table of Contents