Strategies

Reversal Expert Advisor Drawing

Reversal Expert Advisor Drawing

The attached VTS system is a single-drawing that implements a reversal system.

It uses the function fnGetOpenOrderInfo twice:

  • once get the number of open orders (MyTotal)
  • once to get the type of open order (MyOrderType)

It uses 2 Logics

  • one to set the order type (OP_SELL or OP_BUY) if an order is open (AreThereAnyOpenTrades)
  • one to open a trade if none are opened, a SELL if the last trade (held in _MyOrderType) was a BUY, or vice-versa

Notice I try to give the names of each Element a descriptive name.

Notes:

  • The MetaTrader MQL built-in variables for order types are OP_SELL and OP_BUY.
  • In VTS, when you create a function that returns a value, a variable is automatically created to hold the value with the same name as the function with a preceding underscore.

This logic is a little tricky, I may add a function to VTS to automatically run a reversal.

I’ll add a video to this post shortly.

ReversalSystem

  iExpertAdvisor - MetaTrader Expert Advisor Builders

Leave a Reply

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

*