Strategies

EMA Trading System

This is a trading system that a client requested. It used an EMA and an offset, a trailing stop, a time restraint and a profit exit. I may rebuild this as I did not implement the open-buy rule 100% correct. (I’m still testing this upload process).

Here are the rules of the system: o   ea that buys when last bar close is above ema (adjustable) AND current market bid exceeds last bar high by a predetermined number of pips (and symetrically)
o   stops at predetermined SL
o   takes profit at a predetermined level with an adjustable trailing stop feature possible
o   starts again when deal closed
o   adjustable period of trading (day, time)
o   stops trading when a given amount of loss or profit is reached by the instance running

VTS System Zip File: system1.zip

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