MMA_Breakout_strategy_Volume I - coded by WhooDoo22.:
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 .
2. Erase "if order profit >= 0" and "if order profit < 0". Just designate iMAs to a shift of 1 ONLY aka .
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.
Thanks for this good EA, but can be only run on demo account because actually is too risky for real.
Need to improve...
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.......
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:
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