MQL / Using VTS

Get an Indicator value for any Timeframe or Period

Get an Indicator value for any Timeframe or Period

The VTS Wizards are great for getting started, but the true power of VTS lies in its unrestricted, free-range drawing.

You can drag and drop Elements anywhere on the Drawing Pad and connect them in any manner.

Don’t know what an Element is? Read about it here: VTS-Help ELEMENTS

One useful Element is the Technical Indicator.

The MetaTrader (MT) platform offers all of the popular technical indicators, such as Moving Averages, Bollinger Bands, ADX, RSI … the list goes on and on.

To get the value of an indicator in MQL, you call the indicator by its name and define a value for each of its parameters. (The parameters are the values in the parenthesis).

It might look something like this:

   iRSI( Symbol(), 0, 14, PRICE_CLOSE, 0 ); 

So, you need to know the position and possible value for each parameter. This is tedious, so I made it easier.

To do this in VTS, you drag the iRSI function from the Indicators menu onto the Drawing Pad. The configuration dialog displays the appropriate values for each parameter – you pick one, select OK and you’re done.

VTS will generate the correct MQL code for the indicator.

Even I, a seasoned MQL programmer, find these entry-screens extremely helpful.

The best part? Even if you don’t explicitly assign values for each parameter, VTS assigns a sensible default value.

One parameter, named Timeframe, is available for all MT indicators.

This parameter allows you to define the timeframe that the indicator is calculated on. The values can be from 1 minute up to 1 month. Again, in VTS, the possible values are presented on a user-friendly pick-list.

Drag, drop, configure. Using VTS, you can define indicator values for multiple timeframes very quickly.

You can learn a lot more about VTS functions here: VTS-Help Functions

Warm Regards,


P.S. The MetaTrader MQL documentation is a great resource for learning about each indicator and its parameters. Learn how to access the MQL help here: VTS-Help MQL Help


  iExpertAdvisor - MetaTrader Expert Advisor Builders

Leave a Reply

Your email address will not be published. Required fields are marked *