MQL / Using VTS

What is the heart of an Expert Advisor?

What is the heart of an Expert Advisor?

Opening and closing trades is not the heart of an Expert Advisor.

Neither is the number of lots traded. And it’s not the value of the stoploss or the takeprofit.

Those parts are important for sure, but they’re mechanical and usually pretty straightforward.

No, the important part of an EA, the very heart of an EA is its logic.

The logic used to open a trade. The logic used to close a trade. Even the logic used to calculate the lot size and the stoploss and the takeprofit.

In VTS, we use Logic Elements to construct the heart of an EA.

I’ve really gone out of my way to make defining the logic easy. For instance, to test for a “cross over”, I created two special operators that you’ll only find in VTS: CROSS_UP and CROSS_DOWN.

To recognize that two lines, say line A and line B, have crossed requires 4 points of information. The values of line A and B now, and the values of line A and B from earlier (maybe from the last  candle).

If the value of A used to be less than B, but now it’s greater, then the lines have crossed.

I write about this in MQL For Traders.  Here is a picture from page 116 that might help. See how the value of the blue line used to be less than the green line (in Period2), but now it is greater (in Period 1.)

 

Cross Over

Cross Over

You wouldn’t realize this unless you really thought about it, huh?

You don’t need to know things like this to use VTS. I suppose it might help, but it’s not mandatory knowledge.

You definitely don’t need to know how to write the MQL code for a cross over. (Honestly, I don’t even like writing that code – it’s confusing and very easy to make a mistake).

You can read more about VTS Logic Elements here:

VTS-Help-Logic

You can easily view the MQL code that’s generated from the CROSS_UP and CROSS_DOWN operators. Just click the Editor button inside of VTS. You can learn more about the Editor here: VTS-Help-editor.

  iExpertAdvisor - MetaTrader Expert Advisor Builders
Tags: /

Leave a Reply

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

*