Download MetaTrader 5

Experts: MMA_Breakout_strategy_Volume I - coded by WhooDoo22.

To add comments, please log in or register
Trade like successful traders - subscribe to their signals!
MetaQuotes Software Corp.
MetaQuotes Software Corp. 2012.09.29 07:59 

MMA_Breakout_strategy_Volume I - coded by WhooDoo22.:

Strategy is founded on support and resistance AND the theory that the market moves in trends or consolidated horizontal movement containing smaller ranges. It uses default custom indicator moving average and partial order closing. -WhooDoo22.

Author: Nathan

Nathan 2012.10.29 00:40  

Hello MQL4 community,

DO NOT RUN MMA_Breakout_strategy Volume I - coded by WhooDoo22 on a LIVE account!

This is because I did not filter out consolidated market conditions in the signal parameters of this EA. If this EA is run on a live account during consolidated market conditions false signals will gobble up an account balance very quickly. The purpose I chose to share this EA is to educate coders and traders. If all goes as planned, Volume II will be able to run on a live account no problem and will be added to the code base if "higher-ups" allow it to be added to the code base. Study this EA to your benefit if you wish. The choice is yours.

A significant coding mistake to be corrected in "MMA_Breakout_strategy_Volume_I - coded by WhooDoo22" is contained within the "OrderClose()" code blocks. Replace "Ask" and "Bid" prices with the opposite market price. Example: If "Ask" is contained within the "OrderClose()" code block, replace "Ask" with "Bid". If "Bid" is contained within the "OrderClose()" code block, replace "Bid" with "Ask".

1. Replace the order close functions containing decisions of closing orders by iMAs to a shift of 1 ONLY and erase all order closing iMas shift values of zero aka [0].

2. Erase "if order profit >= 0" and "if order profit < 0". Just designate iMAs to a shift of 1 ONLY aka [1].

Following steps 1. and 2. will make your tests much more profitable. You can even try using it on other currency pairs like GBP/USD or others to visualize possible "iMA 200 trend patterns" that can be profited if filtered using

"market filtration" ("market filtration" will be touched up on below).

Helpful tips to coders searching to write a "more profitable" expert advisor:

1. Decide upon a currency pair with the lowest spread. EUR/USD is an example.

2. Run tests in mt4 strategy tester on your designated currency pair with low spread.

3. Hunt for market patterns. FOREX EUR/USD pair has three market patterns: 1. Trends, 2. Ranges within trends or 3. Ranges within consolidated aka consolidated ranges.

4. Decide what pattern you will be profiting from first. When you decide, you can use strictly price arrays (example: 30 bars) OR an indicator (example: iMAs) that takes advantage of the decided pattern.

5. If you are using price arrays OR indicators, realize that both run on designated periods. You cannot profit from every market move. You must decide which move to profit from AND be sure that the move is big enough to carry your order from point A. to point B. (low spread helps because this means that your order does not need to travel as far from point A. to point B. to move into profit. KEY factor).

READ: All Currency pairs are based on the physics of SUPPORT AND RESISTANCE. Euro VS. Dollar. Which currency is stronger? AND is the strength of one currency so much stronger than the opposing currency that an opportunity to send an order presents itself? Once this is understood, you will understand that you must look for big enough moves of support OR resistance that will carry your order from point A. to point B. What now becomes most important is to realize that if a big move of support or resistance is made, understand that the move can continue up with the same force OR reverse with the same force. The key is to be ready for a move of either up OR down. "For every action, there is an equal and opposite reaction" - Sir Isaac Newton (physicist).

6. Here is the fun part ;)

Once you understand the above statements you understand that your indicator or allotted price array works well under specific market conditions that work well under that period ALONE.

What you might not understand is, "How do I filter market conditions that work well under the designated period?"

An answer to this question is to save the price values where your order would have closed IF an order was sent. Add or subtract these values from the price value of where you would send an order. Once these price values go positive, subtract the spread value from these calculations. If the result is still positive, it is time to start sending orders. Remember, "Birds of a feather flock together." This statement pertains to market patterns ;)

I would advise the use of partial order closing to maximize return of potential market movement. (You never know which direction the currency pair will go OR how far it will travel, BUT ;), you can be ready for what the market could do). Remember to maximize profit and minimize risk. KEY.

Once a buy order loses, DO NOT open any more buy orders UNLESS the next sell order goes into profit. If the sell order DOES NOT go into profit, it is time to wait until price values go positive once again.

In essence, the expert advisor is waiting for appropriate market conditions to apply the strategy of your choosing. The expert advisor chooses these appropriate market conditions if an "artificial order" would have profited from the condition assigned by your price array or indicator. The EA's strategy must use an allotted period of the market to scan. If the EA scans a profitable market condition, it should wait for a signal of a similar market condition in the future. The strategy should use history and current price. That should pretty much cover it.

A back-test snapshot using open prices only was done for MMA_Breakout_strategy_Volume II from date 1999-2012.10 (eurusd, m15). this test was performed without market filtration or money management.

Thats all for now, but if I have any information of any value regarding MMA_Breakout_strategy_Volume I or II, I will post below. Thank you for your interest in my EA.

Thank you.

MQL4 Comments
MQL4 Comments 2012.11.07 20:14  

Thanks for this good EA, but can be only run on demo account because actually is too risky for real.

Need to improve...

Nathan 2012.12.11 04:34  
I thought it would be helpful for new coders (and experienced coders) to post an updated version of MMA_Breakout_strategy_Volume I, so novice/experienced coders alike could have a chance of understanding the two important updates  required for this EA (volume I) to run smoother and more efficiently. This version does not include money management or market filtration and is still considered volume I. (I am still deciding how to implement both money management and market filtration features into volume I to ultimately evolve volume I to volume II. I will share a portion of my thoughts of accomplishing both tasks of MM (money management) and MF (market filtration). MM: As you well know, volume I uses a single order and partially closes its order as the moving averages cross. This goal for MM is to increase the lot size as the account balance grows (example: account balance increases $1,000, code block will adjust the current lot size to double the current lot size. This code block will also decrease the lot size to half the current lot size if the account balance loses $1,000. This is the current objective for MM. As for MF: I am thoroughly considering all options before opening this door to my inexperienced coding territory. I can think of multiple ways to accomplish this task. The question remains for me, which option should I choose? I have begun coding versions of volume II with MF feature to become familiar with new and different techniques. Repetition of trial and error will guide me to the completion of this project. Be sure to run from 1999-2012.10 on M15 time frame EURUSD to verify most recent back test posted of volume I (it is also considered partly volume II). On a side note, I am blown away volume I has been downloaded 10,000 times within two or so months! WOW! :) I am so glad my work has proven itself valuable to coders/traders. Thank you. - WhooDoo22. MMA_Breakout_strategy_Volume I (updated) download link
MQL4 Comments
MQL4 Comments 2013.01.20 12:47  
Hello WhooDoo22, thanks for your share. I'm a fresh bird in coding EAs. Although my C programing experience helps coding MQL4, it's a big difficulty for me. I gained very substantially froom your code I. And expect your next code "II" and discuss with you.
MQL4 Comments
MQL4 Comments 2013.01.20 13:37  

I think it'll be better and profitable if more indicators are added in the EA's ordersend() conditions. Whether it's better the ordersend time is limited in certain time period, i.e., from European at 10:36 am to American 3:36 pm, in which the market is more active and error trading signals are less.

Anyway, your code is very good for new coders/traders. Wish to discuss with you about the Forex market and EAs. Expecting....... 

MQL4 Comments
MQL4 Comments 2013.06.11 08:24  

This one seems to be quite popular here, will have to give it an in depth look. I'll see if I can get it added on this EA comparison here:

MQL4 Comments
MQL4 Comments 2013.10.01 01:45  
Going to add it to this Best Forex Robot Competition on a demo account.
sanoop 2015.01.12 21:07  

Hi WhooDoo22 , 


I am a novice in the EAs. I downloaded your EA and while backtesting was giving compilation issues in lines 9 & 10 so I removed the periods in those lines as follows

"extern string CodedByWhooDoo22="";

extern string ThanksToMQL4Comunity=""; "

After this change the EA compiles and tried doing the back testing with data for EURUSD from 2010 jan 1st to 2015 jan 1st. But I am getting the following errors in the journal tab and no orders are placed. 

" 3 06:53:38 2014.12.31 10:54  MMA_Breakout_strategy_Volume_I_-_coded_by_WhooDoo22 EURUSD,M1: invalid takeprofit for OrderSend function

3 06:53:38 2014.12.31 10:54  MMA_Breakout_strategy_Volume_I_-_coded_by_WhooDoo22 EURUSD,M1: OrderSend error 4107

3 06:53:38 2014.12.31 10:57  MMA_Breakout_strategy_Volume_I_-_coded_by_WhooDoo22 EURUSD,M1: OrderSend error 131"


There are lot of repetetions of the same error. Please guide me about how to solve these errors.

 I have attached the report along with this so that you can gete some more information.

Thanks in advance 

To add comments, please log in or register