The Opening Range Breakout EA
This document serves as a manual for the EA https://www.mql5.com/en/market/product/90502/ and will be updated as and when required.
IMPORTANT NOTE:
Please DO NOT use the default settings in the EA, those settings are not designed to be used for real trading. EAs listed on the MQL5 marketplace have to undergo stict testing criteria on multiple instruments and timeframes and while this is good for testing the logic and code of an EA this hinders being able to list EAs that are designed to work on specific instruments and timeframes like this one. So the default settings are designed to get the EA to pass these tests on hourly and daily timeframes which it’s not designed to run on but has to pass validation for. 🙂
The EA is designed to be run on the M5 timeframe ideally as it monitors opening range activity on the major stock indices.
WHAT’S IN THIS BLOG POST:
1. NOT the strategy, that’s listed in another post, a strategy guide to how the EA trades can be found here: https://www.mql5.com/en/blogs/post/751229
2. A detailed list of all the inputs and what they do as well as how they affect trading.
HOW TO USE THE RANGE BREAKOUT EA:
The EA can be customised to trade on any timeframe but M5 is recommended so it should ideally be placed on the M5 timeframe. It can be set to take trades at any time of day so can also be used to trade other ranges that form like the Asian sesssion in Forex or you can use it to trade just before news events where it will place pending orders at strategic highs and lows before a news breakout happens. TEST, TEST, TEST in the strategy tester before you do anything on any other timeframe though!
Finding the open for Frankfurt and New York:
The EA was developed to trade the open of the Frankfurt and New York stock exchanges so you need to tell it when these times are. As brokers candle close times wil vary you will need to work this out and it can be tricky but there is a very simple way to do this using volume.
If you are using the EA to trade the Frankfurt open that is at 9am (10am GMT), the New York open is 9:30am (14:30pm GMT). Your brokers candles however will likely not be those times. For example with the broker Roboforex who uses UTC+2 candles (which the majority of brokers now do) will have the open in Frankfurt at 10:00 and New York at 16:30.
So lets use volume to confirm we’ve got the right open time.
First open the instument you want to trade like the DAX, DOW, NASDAQ etc….
Then right click on the chart and make sure you have volume checked in the common properties tab as shown below.
Now you will see the volume from your broker shown on the bottom of the chart. You can clearly see at 10:00am on the DAX index on my brokers chart that the volume doubles and is often even larger.
Likewise on the US indices like the NASDAQ in the example below you will see a substantial increase in volume at 16:30 on the chart which is 2:30pm UK (9:30am NY).
This is the open.
INPUTS FOR THE EA:
Here I’ll detail every input and what impact it has on trading activity. I would strongly recommend you put the EA in the visual backtest, play with these settings and see for yourself what happens though. You can fine tune the EA to trade with a high strike rate and small wins, low strike rate and huge home run wins and everything in between. How YOU PERSONALLY want the EA to trade to help with either your personal account or passing a prop firm evaluation will differ from the next trader so set it to trade how YOU want it by seeing how it works. Some people are happy with 30-50% drawdown on a proven long term edge, others can’t stand losing more than 3-5 trades in a row without giving up, who you are is important, even with an automated strategy, don’t ever blindly add an EA to a live account without FULLY understanding the logic and how it trades.
INPUTS:
Magic Number – This should be unique for every instance of the EA so it knows which trades to manage. It will only manage trades it has opened with this number. If you want to run multiple versions of the strategy on the same instrument use multiple magic numbers on each instance.
— RISK & TARGETS —
Amount of money to risk per trade – Select the amount of money to risk on each position taken. This is based on your stop loss and the EA will automatically calculate the correct lot sizing based on how far away the stop loss is placed. By default the EA places the stop at the opposite end of the range unless you select to use a fixed pip stop loss in the inputs below.
Position 1,2 & 3 TP multiplier (percentage of stop loss) – These inputs will calculate where to place your take profits for each position entered based on the stop loss.
For example: If you use 100 as the input the EA will place your TP 100% of the distance of your stop loss. So if your stop loss is 30 pips your take profit will be 30 pips.
Is you input 150 then you are asking the EA to place your take profit at 150% of your stop loss. So in the example of a 30 pip stop loss the take profit would be 45 pips.
If you would prefer to not use a take profit and just trail the stops then just use 1000 as your input for all three and the take profit will be so far away it will never get hit and your trailing stop loss method will get you out of the trades.
Use a fixed pip stop not opposite range – As mentioned above the EA will automatically place the stop loss for each position at the opposite end of the opening range unless you set this input to true.
If true then you can choose to have your stop placed at a fixed distance for each trade. Some brokers will quote in mini and others in micro increments so you will need to check the actual distance you need to enter here but it will typically either be 30 or 300 for a 30 pip stop as an example. Some brokers like Axi however will quote in 1000 pipette increments so just check visually on your chart and adjust as necessary.
Fixed pip stop to use – This is where you enter the amount for the above input when using a fixed pip stop loss.
Auto exit at percentage of balance – Have the EA automatically close all positions when a percentage target is reached which is a percentage of your account balance. For example if you have a $10,000 account and select a 1% profit target when the total of all positions open reaches $100 the EA will close the trades and bank the profit for you. This setting is great for passing prop firm evaluations and for those that want to make small consistent gains.
Profit percent target – This is where you enter the target from the input above as a percentage of your account balance.
— TRADING TIMES —
Range start time – The time you want the EA to start monitoring the range. This will typically be the Frankfurt open or the New York open if you ware using the EA for trading indices.
Range 1, 2 & 3 end times – These are the 3 breakout times which is where the EA will place it’s pending orders ready for the market to breakout. So if you selected 10:00 as an open time (Frankfurt on my broker) and you wanted to take the breakout high or low of the 5. 10 and 15 minute bars you would enter 10:05, 10:10 and 10:15 respectively in the inputs. A good strategy is to use multiple entries so you are adding to breakouts that start to work and multiplying profits.
Stop trading time – This is when the EA will cancel pending orders and stop taking trades that have not triggered. This is designed to make sure if a breakout has happened in one direction we are not leaving old orders lying around that may trigger late in the day. If it’s not broken out and working within the first couple of hours then it’s best to remove the orders.
Take range breakout 1,2 & 3 – Select how many breakout levels you want to trade. Trade up to 3 breakout times/levels or just a single one, remember the more you add to a winning breakout the more you can make but conversly if it breakouts out of all 3 and then reverses losses will be higher. Test what works best for you.
— TRAILING STOPS —
Activate on bar close (on tick otherwise) – You can choose to have your breakeven and trailing stop settings trigger only when a bar/candle closes (this is default as true) or on every tick. Backtesting has shown that using bar close is more effective as it filters out the sometimes choppy action in a candle which can stop you out and then continue to run. Conversly using tick will get you out faster if a reversal happens and price moves against you.
Use a trailing stop loss – Set whether to use a trailing stop loss or not.
Distance to trail stops by – This is the distnace the EA will need to be in profit before it starts to trail your stop. It will trail in 1 pip increments when activated.
Use a break even stop loss – Set whether you want to move stops to breakeven to protect your trades that have moved into profit.
Distance to trigger breakeven – How many pips in profit do you want your trade to be before the breakeven is triggered.
Use moving average as trailing stop loss – Use a trailing stop loss based on an SMA moving average rather than a trailing stop. This will get you out of your trade when price closes below the moving average you select in the next input.
Moving average to use – This is where you set which SMA you would like to use to trail with. The 9 SMA is typically a good choice on the 5 minute timeframe to capture large portions of a trend move but experiment.
— ADD TO SINGLES —
Add to single trades when in profit – Taking multiple breakouts automatically adds to breakouts that work for you but if there is just a signle breakout taken the EA can add an additional position to your winners after a certain number of pips to maximise your returns on winners. If set to true here the EA will do that but only if there is just one live trade running and it will only add once.
Distance before an add-on order is placed – This is the distance from the initial entry price needs to be before it adds another position.