FX Rogue Wave Expert Advisor (An MT4 Forex breakout strategy)
Written by IBtheScottyB
The concept of trading Forex to me is similar to surfing at the beach. The object of the exercise is to catch a wave and ride it as long as you can. If you start paddling on EVERY wave, you will exhaust yourself. In Forex, you will exhaust your capital. You can no more guess what the price is going to do in Forex, than you can guess how big the wave is going to catch.
Therefore, we will take the only certainty in Forex that I have found and that is… at any given point, the price WILL go up or down. The object of THIS exercise as far as this strategy is concerned is to choose times when a currency is stable or flat. As we know that Order leads to Chaos. We will use that to our advantage when preparing to trade.
The purpose of this EA is to be loaded on an individual chart and calculate entry points and place BUY and SELL orders above and below the Donchian Channel Lines. Examples given will be on BUY (long) positions with opposite being true for SELL (Short) positions.
Prior to market open – market must be flat (within specified range). After market opens EA will be allowed to enter trades for two to three hours.
Example for New York Open
Prior to market open – market must be flat
If market is flat, then
7:00am to 10am EST – EA will watch for PA to exceed Donchian Channel + Entry_Pips_Buffer + Spread
1. EA will place BUY order if Price Action (PA) moves above Donchian by Entry_Pips_Buffer + Spread.
2. Initial stop loss will be placed at previous candle low + SL_Pips_Buffer+ Spread (or 30 (Initial_Stop_Loss ) pips if this is not possible).
3. Trailing stop will be placed at previous candle low + SL_Pips_Buffer + spread : modified every candle if PA makes it possible to do so.
Definition of “Market must be flat”
There may be several methods for determining this. My thoughts are maximum distance measured in pips between Donchian Lines for some period of time measured in candles. The time when Donchian set for 20-25 should accomplish this.
When trading manually, I wait until the Donchian lines are close together : 5-30 pips apart : Then I place two pending orders One each above/below the meeting of the lines.
Donchian Channel looking back 20 - 25 candles.
3 Options (true or false) – EA only trades during certain times for three markets : NY, ASIA, and London openings. Trade one session or all three. Or set one to true with start time at 0:00 and end time for 23:59 to run 24/5.
For initial testing, I would like the Times to be user definable. GMT can be used if easier to code.
New York TRUE/FALSE Turning this market on or off
Trade Time Start 07:00 EST Trade Time End 10:00 EST
ASIA TRUE/FALSE Turning this market on or off
Trade Time Start 19:00 EST Trade Time End 22:00 EST
London TRUE/FALSE Turning this market on or off
Trade Time Start 02:00 EST Trade Time End 05:00 EST
Entry Point Rules
Controlled by EA - not pending order
1. If time is between Trade Time Start and Trade Time End; AND
2. Donchian Channel lines are less than Donchian_Max_Distance THEN
EA monitors Donchian and will place BUY order IF
PA exceeds Donchian + Entry_Pips_Buffer + Spread
Initial Stop Loss
Is set to Initial_Stop_Loss, but will be modified to previous candle as determined by Candle_LookBack + SL_Pips_Buffer + spread as soon as possible.
Moved to previous candle low as determined by Candle_LookBack + SL_Pips_Buffer + spread. Calculate and modify order each candle close.
Trade will close by Trailing Stop
User Definable Settings
Magic Number 1234 (four digits)
Lot Size .01 (.01 – 50.0) Suitable for Standard or Micro Lot sizes
Candle_LookBack 1 (1 – 50) How many candles to lookback For SL and TS
Entry_Pips_Buffer 5 (1 - 50) Pips above resistance to enter trade
SL_Pips_Buffer 5 (1 – 50) Pips below previous candle for SL and TS
Initial_Stop_Loss 30 (1 – 200) Stop Loss to be set at order entry
Slippage 3 (1 – 10) No Trade if Exceeded
Max Spread 5 (1 – 10) No Trade if Exceeded
Attempts 5 (1 – 10) EA retries if “trade context busy” error received.
Donchian_Max_Distance 15 (5 – 50) Max Distance in Pips between Donchian
Donchian_Lookback 25 (1-200) Number of candles to lookback for Donchian Chnl
Name of EA “FX Rogue Wave” copyright 2011 (TOP LEFT OF CHART)
Donchian Channel Colors ( Thick Lines - Blue for High and Red for Low)
Thin Lines drawn on chart where EA planned entry points will be (for testing and monitoring)
BLUE FOR BUY, RED FOR SELL
Order open arrow in Blue (FOR BUY) Tiny blue arrow placed at order entry
Order Close arrow in Red (FOR BUY) Tiny Red arrow placed at order close
To be displayed on right side of chart: Where chart shift allows room to view clearly.
“TRADING” or “NOT TRADING” display TRADING if within trade times
Current Spread in pips self-explanatory
Current Spread “OK” or “Not OK” Display if within Max Spread parameters
Donchian Channel: “OK” or “Not OK” Display if Donchian is less Than Donchian_Max_Distance
Alerts ( I would like some kind of email alert when trades are placed)
Email alert to be sent when order is opened
Email alert to be sent when order is closed (optional)
Usable on 4/5 digit brokers
ECN Broker Execution TRUE/FALSE
As NY and London both follow DST/BST – GMT Offset needed?
EA should attempt to resend order/modification if error is received.
As broker deals with FIFO and NFA on the back end, This should not be a problem. However, we should only be in one order per pair at any given time.
The EA will be loaded onto an individual chart to control a specific pair. The EA should be coded in such a way to trade any instrument offered by broker. Also, other manual trades or EA's may be running on same account, so FX Rogue Wave should only control it's own orders (i.e. Magic Number).
Initial Stop Loss and Trailing Stop Control.
I have another EA (CompuForex Trailing Stop) that controls stoploss based on several concepts. (Except the one I have requested on this EA). I have included it with this package for reference.
Would it be possible to have the STOP LOSS and TRAILING STOP feature on FX Rogue Wave enabled/disabled with a TRUE/FALSE option? That way I can have the CompuForex Trail Stop control exits instead of the FX Rogue Wave EA?
Create a 2nd EA or modify CompuForex EA that only places initial STOP LOSS and TRAILING STOP as outlined above on a single chart to manage all open trades?
I have thought about letting the EA control Money Management based on percentage of account. If there is an easy way to do this, it can be an option. BUT, I want the Lot Size calculation to be based on balance (not Free Margin) like most EA's.
Easy Example: Balance = $1,[url removed, login to view]
MM = 10%
Lot Size would = .1
If 2nd trade were to be open, it would look at Balance which would still be $1,[url removed, login to view]