MT4 backtesting engulfing patterns

 

Hi, 

I've been trading FX for quite a few years but never experimented with automatic trading before. I want to give it a try now with MT4 / EA advisors. 

How do I go about using EA to backtest a strategy of buying on bullish engulfing patterns and shorting on bearish ones, with TP and SL of 1:1? 

I don't know how to program in MQL (would like to learn), but I'd guess that this simple strategy that I'm trying to experiment is probably so generic, that EA has it built-in or the community here at MQL can probably supply the EA script / program because it's so commonly used?

At any rate, love some help in instructions on how to work EA in backtesting this strategy

 
Max H.: I've been trading FX for quite a few years but never experimented with automatic trading before. I want to give it a try now with MT4 / EA advisors.How do I go about using EA to backtest a strategy of buying on bullish engulfing patterns and shorting on bearish ones, with TP and SL of 1:1?  I don't know how to program in MQL (would like to learn), but I'd guess that this simple strategy that I'm trying to experiment is probably so generic, that EA has it built-in or the community here at MQL can probably supply the EA script / program because it's so commonly used?

At any rate, love some help in instructions on how to work EA in backtesting this strategy

You will have to learn MQL. No strategy is built into the language. No matter how simple ou trivial you may think your strategy may be, it will still require quite a bit of coding work.

You may find something already done in the CodeBase, but you will still need to dedicate some time into learning how to work with the strategy tester.

Please note that the MT4 tester does not support testing with real ticks, only virtual ticks based on the OHLC data you have. Real ticks is only possible via 3rd party tools.

Given that you have been manual trading so far, and that only now you wish to evolve to EAs, then I suggest you transition over to MT5/MQL5 which does support real tick data.

And remember, nothing is "easy" or "simple". There is always quite a bit of work involved, be it in researching and learning or in developing and testing.

 
Fernando Carreiro #:

You will have to learn MQL. No strategy is built into the language. No matter how simple ou trivial you may think your strategy may be, it will still require quite a bit of coding work.

You may find something already done in the CodeBase, but you will still need to dedicate some time into learning how to work with the strategy tester.

Please note that the MT4 tester does not support testing with real ticks, only virtual ticks based on the OHLC data you have. Real ticks is only possible via 3rd party tools.

Given that you have been manual trading so far, and that only now you wish to evolve to EAs, then I suggest you transition over to MT5/MQL5 which does support real tick data.

And remember, nothing is "easy" or "simple". There is always quite a bit of work involved, be it in researching and learning or in developing and testing.

Thank you elucidating Fernando. Would I need to sign up with a broker (even just a demo) to use MT5 for back-testing? 

Ultimately, do you recommend executing a live automated trading system with MT5, or could I just resort to MT4 to execute my live trading once the system goes through backtesting? If MT5 is needed for both backtesting and live execution, which broker do you recommend in the US?  I live trade with Oanda, but it doesn't support MT5. 
 
Max H. #: Thank you elucidating Fernando. Would I need to sign up with a broker (even just a demo) to use MT5 for back-testing? Ultimately, do you recommend executing a live automated trading system with MT5, or could I just resort to MT4 to execute my live trading once the system goes through backtesting? If MT5 is needed for both backtesting and live execution, which broker do you recommend in the US?  I live trade with Oanda, but it doesn't support MT5. 

For real tick data, it would be best to use a broker's demo or real account. MetaQuotes does offer demo accounts for MT5 but their tick data quality is questionable.

EAs coded for MQL5 will not run on MT4 (and vice versa). They are two distinct platforms, that are similar but not compatible. To run on both, you have to code with both in mind using conditional compilation for a mix of MQL4 and MQL5 code.

Recommendations on brokers are not allowed on the forum, but even so, I have no idea which USA brokers offer MT5. I only know of the one which MetaQuotes advertises here on the site, which I believe also offers Forex, but I am unsure.

Forum on trading, automated trading systems and testing trading strategies

MetaTrader 5 trading platform is now available for AMP Futures clients wanting to trade futures

MetaQuotes, 2017.05.03 15:29

AMP Futures has officially announced the launch of the MetaTrader 5 platform for trading futures. AMP Futures is a US regulated Chicago-based Futures Commission Merchant (FCM) providing access to the global electronic futures markets for individual traders, as well as US and foreign Introducing Brokerages from 150+ countries around the world.

MetaTrader 5 trading platform is now available for AMP Futures clients wanting to trade futures

AMP Futures offers over a 100 regulated futures contracts on the following futures exchanges:

  • Chicago Mercantile Exchange (CME)
  • Chicago Board of Trade (CBOT)
  • New York Mercantile Exchange (NYMEX and COMEX)
  • Intercontinental Exchange (ICE-US, ICE-UK and ICE-LIFFE)
  • European Exchange (EUREX)
  • Osaka - Japan (JPX)
  • Singapore Exchange (SGX)
  • Australian Securities Exchange (ASX).

If you would like to try for free, real-time demo of futures markets trading using MetaTrader 5, sign up here.

 
Max H.:

Hi, 

I've been trading FX for quite a few years but never experimented with automatic trading before. I want to give it a try now with MT4 / EA advisors. 

How do I go about using EA to backtest a strategy of buying on bullish engulfing patterns and shorting on bearish ones, with TP and SL of 1:1? 

I don't know how to program in MQL (would like to learn), but I'd guess that this simple strategy that I'm trying to experiment is probably so generic, that EA has it built-in or the community here at MQL can probably supply the EA script / program because it's so commonly used?

At any rate, love some help in instructions on how to work EA in backtesting this strategy

As many have said, there is no "pre-built" strategy for engulfing (or any) candlestick pattern. I am actually coding up an engulfing strategy at the moment, you need to actually code the candlestick formations using the iOpen(..) & iClose(...) functions and set your engulfing candle to a maximum multiple of the candle being engulfed. I have the engulfing candle having to engulf the previous candle by no more than 50% (or 1.50x), as I find "significant engulfing" just leads to whipsawing.

Just don't forget to NormaliseDouble(...) ;) 

 
Max H.:

Hi, 

I've been trading FX for quite a few years but never experimented with automatic trading before. I want to give it a try now with MT4 / EA advisors. 

How do I go about using EA to backtest a strategy of buying on bullish engulfing patterns and shorting on bearish ones, with TP and SL of 1:1? 

I don't know how to program in MQL (would like to learn), but I'd guess that this simple strategy that I'm trying to experiment is probably so generic, that EA has it built-in or the community here at MQL can probably supply the EA script / program because it's so commonly used?

At any rate, love some help in instructions on how to work EA in backtesting this strategy

This is not hard for experienced coder, or even a intermediate beginner to write something like this for engulfing candles. It will take months to get to the intermediate beginner level just FYI. 


Here is the short answer if you have never written any code:
1. Learn to write code in MQL4; and like going to school to learn a new skill and spending many hours / month to learn and understand even the basics of writing this code and asking many code questions in the forums you will eventually have your engulfing candle EA.
2. Pay freelancer in the freelance section to get it done in record time and likely cheap for this particular project.

Not what you hoped for, I know but it's just what it is.