Hi Icus2,
First of all, thank you in advance for any and all help with my request.
I’ve been testing various strategies and came across something called the London Breakout strategy. There are different variations, of course, but I’m having some success with a basic one. The problem is that because of my time zone the trades occur in early morning hours which makes it difficult for me to handle so I thought if someone could code me a simple EA according to my trading rules that I could set running before I go to bed then it would do it’s thing and I could check results later.
Also, I would like to be able to use this EA for breakouts in other sessions so I tried to figure out what info I need in the EA for it to work on any breakout in any session as well as provide you with the information you need to code it.
Here are the details:
EA name = SessionBreakout_EA
OVERVIEW
The EA must work on the current chart only and not affect other charts or orders (this way I can load it on each chart I want to trade)
The EA must work with all symbols
The EA must work on all time frames
The EA must remain on top of chart so candles do not cover it
Please use session times as shown in variables so I can use this for other sessions by simply changing the session start and end times
(For example, I can use it for New York breakout by simply changing start times of Asian and Europe sessions to start times of Europe and U.S. sessions, which would measure the last 4 candles of the Europe session before the U.S. session starts)
Please put comments for all items in code so I can understand which code is for which item in case I want to change something later (and also helps me learn to code )
STRATEGY
Measure highest high and lowest low of last 4 candles of Asian session before Europe session starts
Enter buy trade if price goes 5 pips above highest high of last 4 candles
OR
Enter sell trade if price goes 5 pips below lowest low of last 4 candles
Set Stop Loss at 20 pips
Set Take Profit at 40 pips
>>>> IMPORTANT <<<<
-
Once a trade is entered, opposite direction is cancelled. In other words, if a buy trade is entered and the price dips below the lowest low, a sell trade is not entered.
-
Only take 1 trade per session (For example, the EA does not open another trade if the price dips below the highest high and then breaks above it again)
-
Does NOT enter trades in both directions (see above)
-
If a trade is not entered within the first hour after the start of the Europe session, EA does not enter any trades for that session
When the EA loads, please have the EA display the following information on the left of the chart below the trade panel:
------------------------------------------
SessionBreakout EA
------------------------------------------
Lots = [lot size of trade]
------------------------------------------
Stop Loss = [On/Off]
Current Stop Loss = [#] pips
------------------------------------------
Trailing Stop = [On/Off]
Current Trailing Stop = [#] pips
Trailing Stop Start Pips = [#]
------------------------------------------
Profit Target = [On/Off]
Current Profit Target = [#] pips
For example:
------------------------------------------
SessionBreakout EA
------------------------------------------
Lots = 0.10
------------------------------------------
Stop Loss = On
Current Stop Loss = 20 pips
------------------------------------------
Trailing Stop = Off
Current Trailing Stop = 20 pips
Trailing Stop Start Pips = 0
------------------------------------------
Profit Target = On
Current Profit Target = 40 pips
VARIABLES (changeable in inputs)
Corner position - default = Left upper corner
x position - default = 10
y position - default = 30
Lot size - default = 0.10
Stop Loss on - default = True
Stop Loss pips - default = 20
Trailing Stop on - default = False
Trailing Stop pips - default = 20
Trailing Stop start pips - default = 0 (immediately)
Profit Target on - default = True
Profit Target pips - default = 40
Broker Time GMT offset - default = 3
Local Time GMT offset - default = -7
Asian session name - default = Tokyo
Asian session starts (Broker time) - default = 03:00
Asian session ends (Broker time) - default = 12:00
Candle high/low starts (Broker time) - default = 09:00
Candle high/low ends (Broker time) - default = 09:45
Europe session name - default = London
Europe session starts (Broker time) - default = 10:00
Europe session ends (Broker time) - default = 18:00
Any help with this will be greatly appreciated.
EDIT: Forgot to add variables for time of candles.