FAQ

Before I Buy (Pre-sales Questions)

What is VTS?

VTS stands for Visual Traders Studio.

The VTS Expert Advisor Builder is a Windows graphical application that enables
non-programmers to build complex Expert Advisors by dragging, dropping and
connecting logical elements.

The VTS application contains basic functionality to build almost any Expert
Advisor.

Where can I learn more a about VTS and building Expert Advisors?
What do I get when I buy VTS?

VTS is a standalone Microsoft Windows application. You get the VTS application and all help files.

VTS is delivered immediately as a digital download.

The installation program installs the VTS application and all required help files on your local computer.

How is VTS delivered?

VTS is delivered immediately as a digital download. There is no shipping required.

Is VTS a hosted service or local application?

VTS is a Microsoft  Windows application that installs locally on your computer.

My Free Trial is about to expire, how do I purchase VTS?

See this page for our latest offers:
iExpertAdvisor MetaTrader EA Builder Products

What can I build with VTS?

You can create any type of Expert Advisor. There are no limitations.

Can I view the MQL code generated by VTS?

Yes. As you drag, drop and connect your drawing elements on the VTS drawing pad, you can build the system at any time and view the generated MQL code.

Also, you can manually edit and rebuild the MQL code if needed.

Do I own the Expert Advisors created by VTS?

Yes. Completely.
Any EA that you create using VTS is YOUR property. iExpertAdvisor has no ownership claims to your EA or your trading strategy.

Does VTS have any limitations (number of functions or logical statements)?

No. there is no limit on the number of functions or logical conditions that can be created and used by VTS.

What do I need to know to use VTS? Is it difficult?

You should be familiar with Forex trading, including the typical price values (High, Low, Open, Close), how to open and close trades and perhaps some technical indicators.

Some traders find VTS easy to use, while others find it more challenging.

Building a simple EA is easy. Building a complicated EA may or may not be easy.

You should understand that developing an automated trading strategy on a fiercely competitive market like Forex will be challenging and you should be prepared to put effort into the task.

The best way to find out is to try VTS. We offer a free trial from our home page:

iExpertAdvisor MetaTrader EA Builders

Why should I learn VTS?

1. You don’t need to learn the MQL programming language.
2. Even if you know MQL, VTS allows you to build EAs faster and more easily. For example, you don’t need to memorize the parameters for any of the built-in MQL functions: VTS displays each parameter and it’s allowable choices.
3. A VTS system is a drawing. This allows you to easily collaborate on your trading strategies.
4. VTS teaches you to build a trading system, not just an Expert Advisor. As VTS supports more platforms, you’ll be able to build and run your trading strategies on multiple platforms.

How much does VTS cost?

See this page for our latest offers:

iExpertAdvisor MetaTrader EA Builder Products

Can I try VTS before I buy it?

Yes. You can sign up for a free trial here:

iExpertAdvisor MetaTrader EA Builders

Can I install VTS on more than 1 computer?

Yes. The standard VTS license can be installed on up to 2 computers.

Does VTS produce MQL code?

Yes, VTS produces MQL code that you can manually edit and rebuild if needed.

Can I create Custom Indicators with VTS?

No. VTS creates Expert Advisors only. We are currently working on a Custom Indicator Builder.

Can VTS use my Custom Indicators?

Yes. VTS can use any Custom Indicator that is available on your MetaTrader platform. Please note, Custom Indicators that output lines are the easiest to use. Custom Indicators that output other objects, such as arrows or thumbs, can be challenging to integrate into an Expert Advisor.

Is VTS updated? Do I have to pay for updates?

Yes. VTS is updated frequently to support new requests and changes to the underlying platforms.

No. There is no charge for VTS updates.  All updates are free.

What is the best way to get started with VTS?

We created a video series to help get started:

http://www.iexpertadvisor.com/best-way-to-learn-vts.html

What is a Plug-in?

A VTS Plug-in allows traders to easily implement advanced trading techniques using an add-on user interface.

Shortly after the initial release of VTS, requests came pouring in for added functionality. Some of the requests were common and were added to the base VTS platform. Other requests were specific in nature: It did not make sense to add the feature to VTS and then charge all buyers for that feature. So we created the concept of a plug-in that allows traders to purchase only the added functionality that they require.

How do I get support for VTS?

Here is link to our support resources:

iExpertAdvisor MetaTrader EA Builder Support

What are the system requirements for VTS?

Generally, the same as the system requirements for the MetaTrader platform.

If your computer can run Metatrader, then it should be able to run VTS.

Here are some guidelines:

Windows XP/Vista/7/8
2.0 GHz or faster CPU
512 MB RAM (1 GB recommended)
Screen resolution 1024×768 or higher
Modem/connection speed 36.6 Kbps or faster

Note: VTS uses the 3.5 .NET framework. If this is not already installed on your computer it will be automatically downloaded during installation.

EA Inputs

How many trades will a VTS Expert Advisor open at one time?

By default, an VTS Expert Advisor (an EA built by VTS) will only open 1 trade at any one time.

This is governed by these VTS built-in input variables:

  • MaxTrades
  • MaxBuys
  • MaxSells

These are all set to 1 by default, but they can be changed at any time.

How do I use an MQL Input parameter in a Logical condition?

Question:

I am trying to assign an indicator, let’s say RSI, as an input in my EA. Then I want to use it in my Logic. So, the logic will go as “OpenBuy/OpenSell if RSI value is equal to InputRSI” (where InputRSI will be Input-based).

Answer:
I. Create the variable
There are 2 ways to define an “input”  for your Expert Advisor:
(1) Drag, drop and connect a variable element & then set the scope set to “extern” (extern is the keyword used in MQL to define any variable as an input to the EA)
or
(2) Use the Input Manger to create a new input.
For example, create an input variable named “MyRsiValue” and set its value to 75.0
II. Create the RSI function
Drag and drop the iRSI function from the Function Toolbox

 

III. Create the Logic

From the Toolbox NEW pane, drag and drop a Logic Element.

 

Press the (+) button to configure the Logic Element

Set the condition as follows: “if the value of the RSI function is greater than my input value, return true”

 

Notes:

  • The variable MyRSIValue should be defined with a data type as a “double” to support a decimal number like 75.0
  • Connect the Elements as you add them to the pad so they are visible from the Choose menus.
  • Use the Choose menu to set the names of the operands in the Logic if you are not comfortable typing them.
How do I set an MQL Indicator parameter as an Input to my Expert Advisor?
There are 2 ways to define an “input”  for your Expert Advisor:
(1) Drag, drop and connect a variable element & then set the scope set to “extern” (extern is the keyword used in MQL to define any variable as an input to the EA)
or
(2) Use the Input Manger to create a new input.
 For example, create an input variable named “MyRsiPeriod”.
After creating the variable, set that variable, by name, into the parameter value entry box.
For example, for the “period” parameter of an iRSI function, set the value to “MyRsiPeriod”.

Also, Step 6, on this page shows how it is done:

Errors

Errors! Help. Is there a way to debug an EA? Does any debugger for MQL4 exist?

How to Fix a Broken EA

Sorry, there is no built-in debugger for MQL4.

But, here is some information that will help you solve any issue:

1. Expert Advisor will not Build?

Read this post if your Expert Advisor will not compile because of MQL syntax errors.

2. Expert Advisor will not Trade?

Read this post to find out the most common reasons an EA will not trade.

3. Need to Debug your EA?

Read this post to learn how to debug an EA using VTS.

 

What is the Ordersend error 130 I see from my MetaTrader platform window?

Ordersend error 130  is an “Invalid stops” error.

Check the stoploss and takeprofit values to make sure they are good for your  platform & account type.

Variable name too long for MetaTrader MT4 compiler

The maximum length for the name of a variable for MT4 appears to be 30 characters.  (This value may change, but there will always be some maximum)

The error message is pretty clear:

‘v1234567890123456789012345678901’ – too long variable name C:\Program Files (x86)\MetaTrader 4\experts\exits.mq4 (4, 5)

It should not be easy to give a variable a name that is too long using VTS.

Most VTS entry screens  prevent you from creating a variable or function with too long of a name, but occasionally it does happen.

If it does, delete the variable from the toolbox by right-clicking and selecting delete. And then delete all references (all Elements on the drawing pad) of the variable.

If you still have trouble, follow these steps:

1. Remove the variable/s from the input list.
2. Close VTS.
3. Go to this folder:
    C:\Program Files (x86)\iExpertAdvisor\Visual Trader Studio Connect\elements\user\variables\<NAME OF SYSTEM>
(may not have the (x86)
 
4. Delete the file/s that match the name/s of the variable:
            nametoolongggggggggggggggggggg.ve
 
5. Restart VTS.  There should be no reference to the variable and the build will not break for that reason.

 

 

Functions

Is it possible to use an indicator as a stoploss?
Yes – it’s easy to do.
On the window for opening an order there is a button to use an “offset” or a “price value” for the stoploss and takeprofit values.
An offset is a typical value like “20”, “50”, etc
A price value can be the value of any technical indicator such as Moving Average, Bollinger Band – even a Close price or a channel high or low.
This will use the indicator as a stoploss. You can import any of your custom indicators into VTS and then use them just like the MQL built-in indicators.
Note: a custom indicator can be used as well.
Here is a link to more info:

 

How can I create a MetaTrader Trailing Stop that is X pips below the low of a Bar?
The fnOpenOrder function offers a trailing stop parameter with a check box for using an “Absolute value (price)”.
So, for the “Absolute value (price)” you want to set the lowest low minus x pips:
1.   Use the fnGetLowest function to get the lowest value (it’s on the Bar menu)
2.   Create a variable and set it to the value returned by your fnGetLowest function, probably _fnGetLowest1 (use the choose button to find it)
      (Note: the name of the variable that holds the value returned by a function is the name of the function preceded with an underscore).
        On the Assignment tab, use the “Apply an Offset” checkbox to subtract X points (in this case, multiply the value by point: *Point)
        Name the variable MyLow
3. In the fnOpenOrder function, check the “Use trailing stop” &  “Absolute value (price)” & enter MyLow for the value.

 

How can I see the value of an MQL function or variable when my EA is running?
Open the variable (or MQL function) Element, go to the message tab & check ‘send message’ and check ‘write value of Name’.
Then run the EA (on your  demo account) and watch the ‘experts’ tab in the MT platform to see what the value is.

Where are the CandleStick pattern functions?
1. Make sure your version of VTS is at least 4.0.0.37 (In VTS, go to Help->About)
2. Check the Candlestick feature status in the license tab. In VTS, go to Tools->Options->License.
3. The Candle Functions are found in the ToolBox, in the Functions panel, under the menu CandleSticks.

General

How do I configure VTS to use my MetaTrader platform?

How do I configure VTS to use my MetaTrader platform?

The VTS EA Builder uses your local MetaTrader Platform to build Expert Advisors. You just need to tell VTS where you have MT installed for each of these values:

Compiler

After VTS converts Drawings into readable MQL code, VTS uses the MetaTrader compiler to convert the MQL into an Expert Advisor. The Build button on the Main Menu launches the MetaTrader compiler.

Click here for more information.

Compiler Flags

Allows compiler options to be set.
Click here for more information.

Editor

The Editor button on the Main Menu launches the MetaTrader program metaeditor.exe. This program opens the MQL editor.
Click here for more information.

Platform

The Platform button on the Main Menu launches the MetaTrader program terminal.exe. This program opens the MetaTrader platform.
Click here for more information.

EA Output Folder

Defines where EA files are created.
Click here for more information.

Custom Indicator Folder

Defines where custom indicators are sourced.
Click here for more information.

How can I create a Strategy Template

How can I create a Strategy Template:

In VTS, with the system open that you would like to create a template from

Go to Tools -> Package & Share
Check “Save as Strategy Template”
Then select save -> Save & Close

Next time you open VTS
The system will appear in the “Create New System” section of the Welcome page.

Clicking the button on the Welcome screen will create a new system
based on your original system.

The behavior is just like clicking the Cross over Strategy
from the Welcome screen.

 

How to Email a VTS System

The above process of creating  a Strategy Template will create a  *.zip file in the this folder:

C:\Program Files \iExpertAdvisor\Visual Trader Studio for MetaTrader\Data\Packages
(This may be different if you installed VTS in a folder besides “Program Files” or “Program Files(x86)”)

The zip file maybe attached to an Email.

Also, the zip file may be opened in VTS by using the “Open Existing System” on the Welcome Screen.

 

 

 

 

Do I Own the Copyright to my Expert Advisor?

Yes, you do.

Here is a link to a post on how to set the company name and copyright values for your Expert Advisor:

expert-advisor-ownership

Is it possible to build an Alert-Only Expert Advisor?

Is it possible to build an Alert-Only Expert Advisor?

Yes, it is. See this post: How to Build an Alert-Only Expert Advisor

 

How do I copy my Expert Advisor to another platform?

When you click the build button in the VTS application two things happen:

  1. VTS converts the drawings into MQL code.  VTS creates a file with the same name as the VTS system except with a “mq4” extension. For example: system1.mq4.
  2. VTS uses your MetaTrader platform to build an Expert Advisor from the MQ4 file. This file is the EA and has an “ex4” extension. For example: system1.ex4

These files (the MQ4 and EX4) are created in your MetaTrader platforms “experts” folder. For example:

C:\Program Files (x86)\MetaTrader 4\experts

To copy your EA to another platform, just copy the EX4 file to the “experts” folder of the other platform. You may need to restart your MT platform for the EA to appear under the “expert advisor” tab in the MT navigator window.

One of the features of the Mutli-Platform & Script plug-in is an automatic copy of your EA to multiple MT Platforms.

 

How do I delete a VTS Element?

To delete a VTS Element from the drawing pad, select the Element and then press the Delete key on your keyboard.

To delete a VTS  Element permanently from the system, find the Element in the ToolBox, right-click with your mouse and select Delete.

 

Can VTS import an MQL4 file?
We discontinued support for MQL4 import.
The reasons:
    1. It was not very useful when it worked. Except for very simple EAs, the drawings were just about as confusing as the MQL code.
    2. It did not always import correctly. There are so many different ways to write valid MQL code that resulted in incorrect drawings.
So, when we updated VTS 3.x to VTS-Connect we did not include the MQL import function.
However we do make the older version of VTS available to customers of VTS-Connect, so the MQL import function can be used that way, but we don’t recommended or support it.
We may eventually bring it back if demand for it increases.  If MT5 ever takes off, it could be useful as a way to convert from MT4 to MT5.
How can I learn more about all of the MetaTrader functions?

The MetaEditor provides great help on all of the MetaTrader functions.

You can learn how to use it here:

MetaTrader MetaEditor Help

How can I run VTS as administrator?
To run VTS as administrator:

  • On the VTS desktop icon, right-click, select “Shortcut”,
  • then select “Advanced …”,
  • then check “Run as Administrator”
You may need to do run VTS as admin if you are experiencing permission problems related to the User Access Control (UAC) policy on your PC.
UAC problems occur often on Windows Vista.
Do I need the TrendLine plug-in for the TrendLineAlert EA?
No, you do not need the TrendLine Plug-in for the “Trend Line Alert” EA to work.
The “Trend Line Alert” EA can monitor multiple hand-drawn trend lines on multiple charts.  When a line is broken, an alert is generated.  Also, logic can be defined so that lines on multiple charts must be broken for the alert to be generated.  This is a stand-alone product.
 
The TrendLine Plug-in works with VTS. It can determine if a hand-drawn or programatically drawn trend line has been broken. The logic can be used to open/close/modify a trade, send an email, etc.
I can’t load the MetaTrader platform or the MeTaeditor inside VTS

First, make sure your MT Paths are set correctly. See here for details:  MT Path Help

When you select the Editor or Platform buttons on the top of the VTS application, VTS simply calls the executable file and attempts to load it into a VTS tab.

On some windows systems, the call to load the MetaTrader executable file (terminal.exe or metaeditor.exe) fails. The reason is not always clear, but it is probably related to User Access Permissions (UAC).

The buttons are just for convenience, you can always open the platform or the MetaEditor from outside of VTS.

 

How do i find the minimum version requirements for a VTS Plug-in

Generally, each plug-in has a minimum VTS version that is required to support the plug-in.

When you log into the members area, you will see the minimum version listed next to each of your plug-ins.

To determine what version of VTS  you are running, in VTS go to Help->about

To upgrade, in VTS go to Help->Check for updates
The best practice is to simply always have the latest version.
To make sure you get all emails related to VTS updates, use the sign-up box inside the members area.
(Note: not all plug-ins require additional code downloads.)
How do I update VTS?

There are two ways to update VTS:

  1. Log in to the members area and download & run the latest installation file.  The members area log in is on the top right menu of our home page at www.iExpertAdvisor.com
  2. Or, in VTS, go to Help->Check for Updates and follow the prompts.
How to Update Visual Traders Studio (VTS)

How to Update Visual Traders Studio (VTS)

How can I find out the version of VTS?

To find the VTS Version, in VTS, go to About->Help

How can I get the VTS Free Trial?
The VTS Free Trial is available on our website. You can signup right from our home page here:

 

How do I know the Power plug-in is enabled?
When the power plug-in is enabled, any indicator that has a shift parameter will have a power tab on its configuration window.  Also, any Logic element will also have  a power tab on it’s configuration window.
Here is a link the help:

Will VTS work through a proxy server?

Yes, VTS should work through your default proxy server.

Here are some advanced instructions for manually setting a specific proxy server if you can not use your default proxy server.

In the VTS install folder there is a file named “vApp.exe.config”.
Your VTS install folder is probably here:
C:\Program Files (x86)\iExpertAdvisor\Visual Trader Studio Connect\vApp.exe.config
 
You can add proxy info to this file.  
 
 
If you need to specify the proxy’s name and port, add this after the first <configuration> tag:
 

<system.net> <defaultProxy> <proxy proxyaddress="http://[proxy address]:[proxy port]" bypassonlocal="false" /> </defaultProxy> </system.net>

You replace [proxy address] with your proxy name & [proxy port] with your port.

The “vApp.exe.config” can be edited using notepad or any other text-only text editor.
The entire file might look like this:
<?xml version=”1.0″?>
<configuration>
 
   <defaultProxy enabled=”true” useDefaultCredentials=”true”>
     <proxy usesystemdefault=”true” bypassonlocal=”true” />
   </defaultProxy>
 
<startup>
<supportedRuntime version=”v2.0.50727″/>
</startup>
 
</configuration>
 
How can I remove all of my data from VTS?

All of the data created by a user when creating VTS systems is stored under this folder:

C:\Program Files (x86)\iExpertAdvisor\Visual Trader Studio Connect\elements\user
You can delete this folder to remove all of your the data if needed.
Also, you can archive this folder if you want to save all of your work to another location.
Occasionally VTS will fail to start, or start slowly. An easy way to determine if this is because of a data file is to move this folder.
Note: It is not sufficient to change the name of the folder. It must be removed outside of the VTS installation folder (C:\Program Files (x86)\iExpertAdvisor\Visual Trader Studio Connect\)
Manual work-around for MT Paths

If you are having a lot of trouble setting the MT Paths to the correct the locations of your MetaTrader platform, there is a manual work-around.

You can edit this file with the correct values:
     C:\Program Files (x86)\iExpertAdvisor\Visual Trader Studio Connect\cfg\settings.txt
Look for these lines, enter the correct folder, then save the file and restart VTS.
Platform=C:\Program Files (x86)\MetaTrader 4\terminal.exe
Editor=C:\Program Files (x86)\MetaTrader 4\metaeditor.exe
Builder=C:\Program Files (x86)\MetaTrader 4\metalang.exe
Only do this as a last resort, since any errors in this configuration file may cause strange results.

 

Will VTS interfere with my current Expert Advisors?
No, installing VTS will not interfere with your other Expert Advisors.
But do not overwrite an EA by creating one with the same name:
When you create a new system in VTS, the default name is something like “system1”, “system2”, etc.
When VTS builds an EA it will create an MQL file named system1.mq4.
So just be sure not to name your VTS system by the same name as any of your existing EAs.
How can I get the latest versions of the VTS EA Builder and/or my Plug-ins?

Log into the members area from our homepage www.iExpertAdvisor.com

Once in the members area, you can access all of your products.

If you have forgotten your password, there is a link to reset it.

Can I change my email address?

We use the email address used to purchase to create your account.  We don’t have an automated method to change your email address.  If you really, really need to change the address, let us know and we will do it manually.

Where is the latest VTS-Expert Advisor Builder Help file?

The latest help files are always at this link:

http://asp.iexpertadvisor.com/help/html/

Pre-Sale, or Before-I-Buy Questions

Most of your pre-sale questions about the VTS Expert Advisor Builder are answered here:

http://www.iexpertadvisor.com/FAQ/

Indicators

How can I reuse an Indicator? I’m tired of changing the CCI period from 15 to 14 every time.

Question:

How can I change the default values of the indicators I add to my systems. For example, when I add the CCI indicator to my system, I always have to change the default value of CCI Period from 15 to 14. Is it possible to change it forever?

Answer:

When you first configure your CCI, name it & save it as something like “CCI_14“.

The go to the Function toolbox, under the name of the system you will find “CCI_14“.

When you need to, drag & drop the CCI_14 function.

Notice when you drag and drop the CCI_14 function on to the pad, VTS does not rename it.  The function name remains CCI_14.  You truly have more than one copy of the CCI_14 function on the drawing.

This means if you change any parameters values of the CCI_14 function, the changes will be reflected in all copies of the CCI_14 function.  If you don’t want this behavior, use a different named function.

If you want the CCI_14 function to be available outside of the current system, add it to the Favorites menu by right-clicking the function in the Toolbox and choose “Add to Favorites”.

 

 

 

How do I get the signal value of the MACD indicator?

Question:

How can I create a variable that defines only the signal of the MACD indicator. I want to to put a logic in which the MACD signal line is crossed up or down.

Answer:

Use the mode parameter to get the Signal value for the MACD.  VTS will populate a pull-down menu with the allowable values.

 

VTS will populate the mode parameter menu for all MQL indicators that support the mode parameter (ADX, Stochastic, MACD).

Basically, any indicator that displays more than one line when you add the indicator to a price chart will have a mode parameter.

Also, this is a good time to name the function appropriately, something like MACD_signal

After you connect the function and save the drawing, the MACD_signal value will be available from the Choose menu to use in a logical condition.

 

What’s with the names of the Indicator functions? iRSI2, iStochastic1?

Question:

When I choose indicators to add to my system some of them end in number 1, and some in number 2 (for example, iRSI2, iStochastic1). What is the difference, and what do these numbers mean at all?

Answer:

VTS generates a name each time you drag and drop an indicator function onto the drawing pad. It simply takes the base name of the indicator and adds a number to the end to get the next available name.

Each function in a VTS system must have a unique name, this is just a first guess.

You, as the system developer, should give all variable and function names a descriptive name.  A good name goes a long way.

For example, an iMA (moving average) function with a period of 6 may be name FastMA.

Some traders will add the parameter values to the name: RSI_12

 

Logic

How can I assign different values to an MQL variable based on logic?

You can just drag and drop the same MQL variable Element onto the true & false outputs of a Logic element & set the value accordingly using the assignment tab.

 

After a variable has been saved, it is available in the Variables ToolBox, under the name of the system it was created in. So you can drag the variable from there to where ever it is needed.

 

Is VTS able to determine the color of an MT4 custom indicator and implement in the logic function?
Yes, tt is possible to determine the color of an MT4 custom indicator, but it can be challenging.
This is a forum post on the subject:

 

Can I have multiple links come from an Element?

Yes, VTS supports multiple Links.

You can have more than 1 output link on any Element, and you can number each link to control the order of execution.

You can learn more here from the VTS help file:

http://asp.iexpertadvisor.com/help/html/links0.html

Can I open trades on a Metatrader H1 chart but make trading decisions based on H4 timeframes?
Yes, that is possible and it is very easy.
  • The EA will open trades on the chart it is attached to, so attach your EA to the MetaTrader H1 chart.
  • In VTS, you just use the pull-down menu to choose the H4 timeframe for the indicator. The EA will use the 4H timeframe to calculate the indicator regardless of what chart the EA is attached to.

Every indicator configuration window in VTS allows you to explicitly choose the timeframe:

How do I count bars back with the close price above or below a moving average?
  • The “shift” parameter is used for iMA (the moving average function or any indicator) to get a value from any “bars back”

http://asp.iexpertadvisor.com/help/html/index.html?order.html

  • The Close price for bars back is accessed like this: Close[0], Close[1], Close[2] …
  • Use the built-in function Point if you want to convert from an integer number  like 20, to a pip value:

For example, in the assignment field of a variable type:  20 * Point

  • Use the function fnOpenOrder to set s/l, t/p and trail.
  • Reverse the logic in the “Close*Order” drawings to close trades (uses fnOrderClose)
Here is a link to a step-by-step tutorial:

 

How to open a trade when the price is X points above the High price of an MT Candle?
How can I:
“Open a Buy trade when the Ask price is N points below the ‘Lowest Low’ in the last M bars”
“Open a Sell trade when the Bid price is N points above the ‘Highest High’ in the last M bars”
Answer:
1. use the function fnGetHighest/Lowest from the toolbox under the “Bar” menu.
2. Create a variable (name it something like MyHigh) and perform the math in the “assignment” tab:
To add an integer number of points, use the MQL variable ‘Point”. Here is an example for 15 points above the highesst high:
_fnGetHighest1 + (15 * Point)
(OR use the new “Apply an offset” feature)
3.
add to the open buy logic:
  Ask GREATER_THAN MyHigh

 

Find 80% range of a Bullish Bar
How can I identify bars that are:
  • 100 pips tall from LOW to HIGH
  • bullish bar
  • the OPEN minus the CLOSE comprises 80% of the bar

Answer:

1. Create a Variable, with a type of ‘double’ and name it “range1”

in the assignment field enter:
(High[1] – Low[1])*0.80
2. Create a Variable, with a type of ‘double’ and name it “range2”
in the assignment field enter:
(Close[1] – Open[1])
3. Connect these Variables in from of a logic and add these conditions to the logic:
High[1] GREATER_THAN Low[1]
and
Close[1] GREATER_THAN Open[1]
and
range2 > range1

 

How can I get the range of a MetaTrader hourly bar?
These steps will get the range of any MetaTrader bar.
1.  price values for bars can be accessed using these MQL built in functions (where index is the shift of the bar)
Close[index]
Open[index]
High[index]
Low[index]
(More info on shift here: a-bar-is-born-the-mql-shift )
2. Create a variable and perform the math is the “assignment” tab:
This will yield the difference between the 2 close values in Pips:
Close[1] – Close[2]
(Note: you could also get the difference between the open & close as Open[1] -Close[1])
To convert the value to an integer number, divide by the MQL built-in variable Point:
(Close[1] – Close[2])/Point
This assumes Close[1] is a larger number than Close[2]. If not, the result will be negative. You can always add a logical condition to a Logic Element to check if the value is less than zero.
How do I check for a simple crossover between two indicators?

1. Drag, drop, connect and configure your two indicators functions.

For example:

  • Drag & drop a moving average (iMA), set its period to 6 and save it as FastMA
  • Drag & drop another moving average (iMA), set its period to 21 and save it as SlowMA

2. Drag, drop and connect a Logic element.

Configure the logical condition:

Set the left operand to _SlowMA

Set the right operand _FastMA

Set the operator to CROSS_UP

This logic will check if the SlowMA has crossed up through the FastMA,

 

 

How to “Open a Buy trade when the Ask price is N points below the ‘Lowest Low’ in the last M bars”

Question:

How do I Open a Buy trade when the Ask price is N points below the ‘Lowest Low’ in the last M bars”?

Answer:

6 easy steps

1. When you first create your VTS system, check the box to create a OpenBuyTrade drawing:

2. On the OpenBuyTrade drawing, drag, drop and connect the fnGetLowest function and a new variable named MyLow

(fnGetLowest  is found in the Functions Toolbox under the Bar menu)

3.  Configure the fnGetLowest function, set the endbar parameter to your M value: (M=12)

4. Configure the MyLowest variable to hold the lowest value minus N points: (N=25)

5. Add the logical condition to IsOpenBuyTrue:

6. Build and Test!

Order Management

Why does my EA close all trades immediately?
There could be many reasons. Please inspect your close logic.
The EA will close an order based on:
  • stoploss
  • takeprofit
  • or close logic.
If the EA was not supposed to close the trade according to your logic, please inspect the criteria of the logic elements on the drawings CloseBuyLogic and CloseSellLogic.
If you do not want the trade to be re-opened on the same signal, use the signal manager. Here is a link to the help:

If you want your EA to close all of your open trades, use the function fnCloseAll.  The fnCloseAll  function is found in the Function’s Toolbox, under the Trade menu.

 

Should my EA sleep and wait on the isTradeContextBusy MetaTrader function to open an Order?

Probably not.

The MQL code usually looks like this:

while(IsTradeContextBusy())

            Sleep(100);

RefreshRates();

I’m not a fan of sleeping in a while loop – the code can hang forever.  The while loop is rarely needed: An EA is executed on each tick, so if the order fails, it’s retried on the next tick, usually in less than 1 second.  

 
One exception is when the EA is trying to open an order for a currency pair other than the chart it is on. In this case, since the EA is running due to a tick from a different currency, the EA can be exposed to a delay.
 
Another case is when the EA is executing ** a lot ** of code. It runs for so long that the prices change while it is running.  The MQL RefreshRates function makes a request to get the latest prices – this is like requesting a tick.
An important point is that the delay experienced in an EA (and almost all programs) is not due to waiting for processor execution, but usually waiting on I/O (input/output).  In this case the network IO. So it’s very rare to have an EA execute that long – unless you call the sleep function! 
(By the way, the isTradeContextBusy MetaTrader function returns true only when another one of your EAs is trying to open a trade.)

 

Is there a way to disable Takeprofit and Stoploss in VTS when creating an EA?
You can use the “fnOrderModify” function to set the limits to zero after opening the trade.  Attach it on the pad after the “fnOpenOrder” function
This will only work if your broker allows this.   Not all brokers allow zero for the stoploss or takeprofit values.
The other option is to set the limits excessively large so that the logic to close the trade will occur before the limit is ever reached. This will effectively disable the Takeprofit and stoploss. 
We are working on a “Client-side stops” Plug-in that will hide your stops from your broker.  Check our product page if you are interested: VTS MetaTrader Plug-ins
How do I create a Trailing Stop that is X pips below the prior bar’s Low?
The fnOpenOrder function offers a trailing stop parameter with a check box for using an “Absolute value (price)”.

So, for the “Absolute value (price)” you want to set the lowest low minus x pips:
1.   Use the fnGetLowest function to get the lowest value (it’s on the Bar menu)

2.   Create a variable and set it to the value returned by your fnGetLowest function, probably named _fnGetLowest1 (use the choose button to find it)
 (Note: the name of the variable that holds the value returned by a function is the name of the function preceded with an underscore).
On the Assignment tab, use the “Apply an Offset” check-box to subtract X points (in this case, multiply the value by point: *Point)
Name the variable MyLow

3. In the fnOpenOrder function, check the “Use trailing stop” &  “Absolute value (price)” & enter MyLow for the value.

Strategies

Is there a Cross Over trading strategy? What is it?

Yes. On the Welcome screen, in the Create new system group there is an icon to create a new CrossOver system.

This will create a VTS trading system that uses a moving average crossover to open and close trades.  It can be used as a starting point for a system, or just as an example for learning.

System Managers

Is there a function available to limit the generation of a new trade for so many bars/so many minutes after a prior trade has expired ?

Yes, the TradeSignal Manager can be used to delay the opening of subsequent trades.

 

 

The delay can be candle-based or minute-based:

 

How can I limit EA to 1 trade per candle?

You can limit your EA to 1 trade per candle using the TradeSignal Manager to limit the next trade.

  • check NEXT_SIGNAL_RULE_DELAY_CANDLE
  • enter 1 for the delay value

 

Easy Email & Communication Manager, (MetaTrader SendMail)

What events can be used to send emails?

The events that are supported through the Communication Manager are:

EA_Started,
EA_Stopped,
TradeOpened,
TradeClosed,
AccountBalanceAbove,
AccountBalanceBelow,
AccountMarginAbove, **
AccountMarginBelow   **
** – these are the margin levels
Also, you can connect logic together to create virtually any event that will send an email.
These events will use the MetaTrader 4 MQL function SendMail. Or if you have the Easy Email plug-in it will use the EasyEmail function to send the emails. The advantage of the EasyEmail function is that it can use a secure email server (which almost all email servers are secure), while the MetaTrader SendMail function has trouble with secure email servers.
There is more info here:
Note:  The Easy Eamil plug-in is not standalone, it must be used with VTS-Connect.

 

How can I find my MetaTrader broker’s local time?

You may need to determine your MT broker’s local time to use the GMT offset feature of the Trade Time Manager.

Here is one way:

  1. Drag, drop and connect the MQL function TimeCurrent (Toolbox->Functions->Time).
  2. Click the (+) button to configure the TimeCurrent function, then select the message tab.
  3. On the message tab, check:
  • ‘send message’
  • ‘write value of time current’
  • ‘write on chart’
When you run this EA, the brokers time is shown on the chart.  You want to compare the broker’s time on your chart to the time of your PC to determine your offset.

What is the default behavior of the Trade Time Manager?

Any time intervals not specifically defined in the Trade Time Manager will have the default behavior of being able to open or close any and all trades.  In other words, it is like there is no trade time rule defined for that period.

For example, if you define a single rule, to close all trades from 3:00-4:59, then the periods from 0:00-2:59 and 5:00-23:59 will have the default behavior of opening and closing trades.

 

When I configure a System Manager does it apply to all of my Expert Advisors?
The settings for the managers apply to the current open system only.  You need to configure any manager settings for each VTS system you create.

We use the word “system” to describe the VTS  “system”: all of the drawings, functions and Manger settings seen when you open a VTS System, or create a new one. 
The output of a VTS System is an Expert Advisor (when you press Build).
Some ideas or “trading implementations” do not lend themselves easily to the drag, drop & connect concept. They are “system wide”, so we created Managers to implement these techniques.