How to Build a MetaTrader Moving-Average Crossover Custom Indicator Using VTS

How to Build a MetaTrader Moving-Average Crossover Custom Indicator Using the VTS EA to Custom Indicator Plug-in

This video shows how to create a MetaTrader Moving-Average Crossover Custom Indicator that shows buy and sell signals based on a moving average crossover.

The EA-Indicator VTS plug-in allows you to create a custom indicator from any VTS Expert Advisor. Within VTS, you simply change the target from “Expert Advisor” to “Ea Indicator” and press “build”. This will create a custom indicator in the MetaTrader platform’s custom indicator folder.

A custom indicator created by the EA-Indicator plug-in draws two lines. A blue line to show open and close BUY signals. And a red line to show open and close SELL signals.

  • A line greater than zero means there is an OPEN signal.
    A line less than zero means there is a CLOSE signal.
    A line at zero means there is no signal.

This example uses a moving average crossover of a fast moving average and a slow moving average.

  • When the fast MA crosses up through the slow MA a BUY signal is generated.
    When the fast MA crosses down through the slow MA a SELL signal is generated.

The process used to create this indicator was to create the Expert Advisor first and then change the VTS target to “Ea Indicator” and build the custom indicator.

For any VTS Expert Advisor that has already been created, the process is to simply set the VTS target to “Ea Indicator” and press “build”.

 Watch This Short Video to how to Create a  Moving-Average Crossover Custom Indicator (enjoy the music 🙂

VTS System Zip File:

MT4 Time Functions: Use the VTS EA Builder to Capture High and Low Values at 7:00 to Open Trade

This Expert Advsior uses the MT4 Time Functions as Part of it’s Entry Logic

The entry logic of this system uses the High and Low values of the candle that is formed at 7:00. The High value is used as a signal to open a BUY trade and the Low value is used as the stoploss.

On the “OpenBuyTrade” drawing I use the MQL function Hour to get the current hour. The hour function returns a number between 0-23.

I also use a function that I added to the toolbox a while ago that determines if a new bar has just been created. This function is called “fnIsNewBar” and returns a value of true or false.

Then I create a Logic Element, named “isSeven”, that checks to see if a new bar has just been created AND if the hour is 8. If this is true, then the 7 o-clock candle has just finished forming, so we can get the final values for the High and Low of the candle.

I get the High and Low values using the MQL series functions High[1] and Low[1]. (The 1 signifies that we are getting the values from the last fully-formed candle). I store the high and low values in the variables “myHigh” and “myLow”, respectively.

So now we have the high and low price values from the 7 o’clock candle. These values will stay the same and will not be reset until the logic of “isSeven” is true . This won’t happen again until the next day:
“fnIsNewBar” EQUAL_TO true

Now for the Open Buy logic. We’ll open a buy order when the current Ask price is greater than “myHigh”.

Also, we’ll make sure it’s past 7 oclock. This is very important . It prevents us from opening a trade using an old value of “myHigh”.

So the logic of “IsOpenBuyTrue” is:

Finally, we want to set the stoploss to “myLow”. This is easy.

In the “fnOpenBuy” configuration window, for the stoploss parameter, check the radio button “Absolute value (price)” and use the “Choose” button to set the value to “myLow” (or just type myLow into the textbox).

That’s it. Just press the “Build” button and the Expert Advisor is complete!

A couple of noteworthy points:
This drawing has 2 links coming from the Start Element and uses the link-numbering feature to make sure the “isSeven” logic is executed before the “isOpenBuyTrue” logic is executed.

The variable element “myLow” does not connect to anything, not even an End Element. This prevents the execution from ending and allows the second link to execute the path connected to “isOpenBuyTrue”.


VTS System Zip File: