仕事が完了した
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
指定
I would like a simple EA to be coded to trade when there is a reversal.
The condition for the trade is as follows:
Buy Entry : There is to be 5 consecutive candles with lower Highs. When the current price breaks the Bar[1]'s High, then a buy trade is activated.
Sell Entry : There is to be 5 consecutive candles with higher Lows. When the current price breaks the Bar[1]'s Low, then a sell trade is activated.
Detail Description as follows:
Extern Parameters
Lot Size [Default = 0.1]
Entry Price [Default =
Slippage [Default = 30 points]
EMA Period [Default = 200]
Entry Price [Default = Market Price. There are to be options: Market Price, Previous Close]
Market Price - Open Trade (buy/sell) once there is a Buy_Entry or Sell_Entry Signal
Previous Close - Buy/Sell at the Bar[1]’s Close price. (This order active for only the time for next 2 price bars. Then deactivate order if not enter)
Take Profit [Default = 150 points]
Stop Loss [Default = Previous Bar High/Low] (Also allow manual setting such as 100points)
Trailing Stop [Default = 50 points (if 0 means no use)]
X = Number of price bars with consecutive lower highs. [Default = 5]
Y = Minimum Range of the X Bars. [Default = 150 points]
For Buy: Bar[5]’s High - Bar[1]’s Low
For Sell: Bar[1]’s High - Bar[5]’s Low
Z = Minimum Distance (pips) from EMA [Default = 200 points]
For Buy: Bar[1]’s High to EMA[1]
For Sell: Bar[1]’s Low to EMA[1]
Active Hours [Timing that this EA will be trading]
Buy_Entry:
Condition 1 “EMA” : Bar[1]’s High must be below EMA[1] and the distance of the Bar[1]’s High to EMA[1] must be greater than or equal to Z.
Condition 2 “Range” : The range of the bars (Bar[5]’s High - Bar[1]’s Low) must be greater than or equal to Y.
Condition 3 “X Bars” :There is to be X (default = 5) number of price bars that have consecutive lower Highs.
Once Bar[0]’s current price breaks above Bar[1]’s High, the Buy_Entry is activated.
The Buy_Entry price is dependent on the Extern Parameter “Entry Price”. If it is “Market Price”, then a Buy is immediately entered. if it is “Previous Close”, then a Buy order at the Bar[1]’s close price is entered. This Buy order will only be valid for the next 2 price bar, if it does not get triggered, then the order is cancelled.
Sell_Entry:
Condition 1 “EMA”: Bar[1]’s Low must be above EMA[1] and the distance of the Bar[1]’s Low to EMA[1] must be greater than or equal to Z.
Condition 2 “Range”: The range of the bars (Bar[1]’s High - Bar[5]’s Low) must be greater than or equal to Y.
Condition 3 “X Bars”: There is to be X (default = 5) number of price bars that have consecutive higher Lows.
Once Bar[0]’s current price breaks below Bar[1]’s Low, the Sell_Entry is activated.
The Sell_Entry price is dependent on the Extern Parameter “Entry Price”. If it is “Market Price”, then a Sell is immediately entered. if it is “Previous Close”, then a Sell order at the Bar[1]’s close price is entered. This Sell order will only be valid for the next 2 price bar, if it does not get triggered, then the order is cancelled.
Note:
The Take Profit and Stop Loss is not to be entered when the trade is executed. IT is to be held in the EA as variables and to be monitored at every tick. When the price has been triggered, the EA will execute the Take Profit or Stop Loss for the current trade. This way, the Take Profit and Stop Loss levels will not be known to the broker during entry.
The 3 conditions for entry should be labelled onto the screen.