仕事が完了した
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
指定
EA REQUIREMENTS
The EA opens and closes trades.
It determines trade types, Buy or Sell.
It should work on all time frames and currency pairs.
It should work on both account types. Live and demo.
(So, I can forward test as well as back test).
It places Trailing stop loss and Take profit lines simultaneously as a trade is made.
The EA has a visual Green Take profit line.
The EA has a visual Red Trailing Stop Loss line.
The EA has Four Adaptive moving average lines.
The EA places Trade arrows on the chart at both entry and exit points.
The EA has different lot sizes available to choose from.
The EA has a trading clock that sets the open and closing of trading times.
I can also close trades manually if necessary.
I can manually amend the parameters and settings on all the above.
Concept.
Once trading times are open a trade is made.
This is based on whether price is above or below the Blue AMA line and that no current trade is in play.
Unless activated by the trailing stop loss line were trade type is the opposite to the last trade.
Once a trade is made trailing stop loss and take profit lines are placed.
During the trade, the AMA lines have control of setting TP and TSL lines, trade arrows and the opening and closing of trades.
As price roams, hopefully in the same direction as trade, price may cross some or all the AMA lines.
For each AMA line price crosses of the same trade type the TSL and TP lines are re set locking in small profits, but not taking them as trade remains open.
Trading arrows are left as price crosses the AMA lines.
If not of the same trade type, trade is closed and replaced in favour of the new trade type. Collecting the previous profits mentioned. Obviously setting new TSL and TP lines and trade arrows as it goes.
As price roams, hopefully in the same direction as the current trade it may eventually activate the TP line.
Once activated the TP line closes the trade and secures profits, a new trade is opened (provided that the trading time zones allow the trade) and once again the direction of trade is based on prices location to the Blue AMA line.
For each TP line activated the more profit are secured.
However, trade can also be closed by the trailing stop loss line.
Again, a new trade is opened (provided that the trading time zones allow the trade). But this time the trade is of the opposite trade type to the last trade.
All trades are closed at closing time.
The Blue Adaptive Moving Average line.
Blue AMA line (5,2,30)
Assuming trading clock times allow a trade, the idea is when Price crosses over the Blue AMA line then a Buy trade is made.
Furthermore, if Price crosses under the Blue AMA line then a Sell trade is made.
A buy trade is closed by a Sell trade and a Sell trade is closed by a Buy trade.
Unless trade is closed by other means such as the trading clock, manually or even by the (TP) Take profit or (TSL) Trailing stop loss lines.
Once the Blue AMA line is activated by price the trade is placed and trailing stop loss and take profit lines are set or re set.
If during a trade price crosses another AMA line which is of the same type, then the trade remains open, if not it is closed in favour of the new trade type.
However, if trade is open and of the same type another trade arrow is placed and the trailing stop loss and take profit lines are re set from that point.
Now the NEW AMA line has the opening and the closing of trades authority.
In other words, the most recently crossed AMA line of the same trade type has control of opening and the closing of the trade and the setting or re setting of TP and TSL lines.
The Green Adaptive Moving Average line.
Green AMA line (20,2,30)
Assuming trading clock times allow a trade, the idea is when Price crosses over the Green AMA line then a Buy trade is made.
Furthermore, if Price crosses under the Green AMA line then a Sell trade is made.
A buy trade is closed by a Sell trade and a Sell trade is closed by a Buy trade.
Once the Green AMA line is activated by price the trade is placed and trailing stop loss and take profit lines are set or re set.
Now the NEW AMA line has the opening and the closing of trades authority.
Also, if no trade is active and the trading clock allows trading then the EA places a trade based on price, so if price is over the Blue AMA line a Buy trade is made and if price is under the Blue AMA line a Sell trade is made.
Unless last trade was closed by the TSL line were the opposite trade to last is placed.
The YELLOW Adaptive Moving Average line.
Yellow AMA line (35,2,30)
Assuming trading clock times allow a trade, the idea is when Price crosses over the Yellow AMA line then a Buy trade is made.
Furthermore, if Price crosses under the Yellow AMA line then a Sell trade is made.
A buy trade is closed by a Sell trade and a Sell trade is closed by a Buy trade.
Unless trade is closed by other means such as the trading clock, manually or even by the TP or TSL lines.
If during a trade price crosses another AMA line and trade is of the same type, then the trade remains open, if not it is closed in favour of the new trade type.
However, if trade is open and is of the same type another trade arrow is placed and the trailing stop loss and take profit lines are re set.
Now the NEW AMA line has the opening and the closing of trade authority.
In other words, the most recently crossed AMA line of the same trade type has control of opening and the closing of the trade and the setting or re setting of TP and TSL lines.
Also, if no trade is active and the trading clock allows trading then the EA places a trade based on price, so if price is over the Blue AMA line a Buy trade is made and if price is under the Blue AMA line a Sell trade is made.
Unless last trade was closed by the TSL line were the opposite trade to last is placed.
The Red Adaptive Moving Average line.
Red AMA line (50,2,30)
Assuming trading clock times allow a trade, the idea is when Price crosses over the Red AMA line then a Buy trade is made.
Furthermore, if Price crosses under the Red AMA line then a Sell trade is made.
A buy trade is closed by a Sell trade and a Sell trade is closed by a Buy trade.
Unless trade is closed by other means such as the trading clock, manually or even by the TP or TSL lines.
Once the Red AMA line is activated the trailing stop loss and take profit lines are set or re set to their NEW locations.
If during a trade price crosses another AMA line and the trade is of the same type, then the trade remains open, if not it is closed in favour of the new trade type.
However, if trade is open and of the same type another arrow is placed and the trailing stop loss and take profit lines are re set.
Now the NEW AMA line has the opening and the closing of trades authority.
In other words, the most recently crossed AMA line of the same trade type has control of opening and the closing of the trade and the setting or re setting of TP and TSL lines.
Also, if no trade is active and the trading clock allows trading then the EA places a trade based on price, so if price is over the Blue AMA line a Buy trade is made and if price is under the Blue AMA line a Sell trade is made.
Unless last trade was closed by the TSL line were the opposite trade to last is placed.
Once a trade is made the following things also happen…
Trade Arrows.
Firstly, the trade arrows are placed on the chart.
A small blue arrow pointing upwards is placed at the entry point for a buy trade.
A small red arrow pointing downwards is placed at the entry point for a sell trade.
This is followed by the setting or re setting and placing of the Take profit and Trailing stop loss lines.
Take profit line.
The take profit line is automatically set at 15 pips ahead of trade.
I also require a visual aid line on the chart.
The idea is as price moves towards this stationary line and eventually touches it, trade is closed, and profit is secured.
Both Take profit and Trailing stop loss lines are placed on the chart at opening and are removed as trade is closed.
I would like the ability to change the number of pips.
Say from zero NO Take Profit line to two hundred pips profit.
Trailing stop loss line.
The Trailing stop loss line is automatically set at 30 pips behind trade.
I also require a visual aid on the chart.
The idea is, as price moves away from the Trailing stop loss line the line is pulled in the same direction as price pip by pip.
However, if price should head towards the Trailing stop line, it then remains fixed until price touches the line and the trade is closed.
Once trade is closed a new trade is made, but as the trade was closed by the trailing stop loss line the next trade made is of the opposite trade type to the last trade. Hopefully following the price direction trend.
Both Take profit and Trailing stop loss lines are placed on the chart at opening and are removed as trade is closed.
They can both be re set to a new location when price crosses a different Adaptive Moving Average line of the same trade type as the current trade otherwise trade is closed and replaced by a different trade type.
I would like the ability to change the number of pips.
Say from zero NO TSL line to two hundred pips.
Lot sizes.
The lot size is automatically set to a standard lot size.
However, I would like to have the ability to change this to other lot sizes, such as a Mini lot or a Micro lot or even a Nano sized lot.
Trading clock.
The trading clock uses military time and is set to allow trades from 08.05 to 16.55 as default.
It will automatically close the trade at 16.55 regardless of whether trade is IN or OUT of profit.
I would like to be able to amend the trading times using military time.
The trading clock activates two visual vertical lines as well as activating trade opening and closing times, one vertical line is green for the opening times and the other is red for closing times, they are placed on the chart accordingly.
Also, if no trade is active and trading clock times allowtrading then the EA places a trade based on the following
So, if Price is above the Blue AMA line a Buy trade is made and if price is below the Blue AMA line it is a Sell trade.
Unless last trade was closed by the TSL line were the opposite trade to last is placed.
Screen Shot Explained.
As price crosses into the active time zone and there is no open trade the EA places a trade.
The trade type is based on whether Price is above the Blue AMA line for a buy trade or if price is below the Blue AMA line for a sell trade.
Unless last trade was closed by the TSL line were the opposite trade to last is placed.
As you can see it is below, so a Sell trade is made.
Once trade is made the EA places TP and TSL lines.
Fortunately, price decides to cross under the Green AMA line.
AS this too is a Sell trade, trade remains open.
However, another Sell arrow is placed at crossing and the TP and TSL lines are re set from that point.
Price continues to fall, and crosses under the Yellow AMA line.
As this too is a Sell trade, trade remains open.
However, another Sell arrow is placed at crossing and the TP and TSL lines are re set from that point.
Price continues to decline and eventually it crosses under the Red AMA line.
As this too is a Sell trade, trade remains open.
A short time later price rises and crosses over the Red AMA line closing trade and securing any profit.
As price crosses over the Red AMA line it also places a Buy trade and sets TP and TSL lines simultaneously for this trade.
Price rises further and crosses over the Yellow AMA line.
As this too is a Buy trade, trade remains open.
However, another Buy arrow is placed at crossing and the TP and TSL lines are re set from that point.
Price crosses back under the Yellow AMA line closing the trade.
However, as price has crossed under the Yellow AMA line a new sell trade is placed along with a sell trade arrow and the TP and TSL lines.
Price being fickle rises again over the Yellow AMA line and a Buy trade is made, closing the previous sell trade and re setting TP and TSL lines.
Price continues upwards and crosses over the Blue and Green AMA lines, each time placing buy trade arrows and re setting TP and TSL lines as it goes.
Price rises and eventually activates the TP line and trade is closed.
As we are still in the trading time zones and there is NO current open trade then the EA places a trade based on Price being above the Blue AMA line.
This being a Buy trade.
Price decides to fall and crosses under The Blue AMA line again.
Trade is closed. However, a Sell trade is placed along with TP and TSL lines as usual.
Price continues to fall and crosses under the remaining AMA lines, placing more sell trade arrows and re setting TP and TSL lines along the way.
Price rises once again and crosses over the Red AMA line closing trade.
A buy trade is made along with its TP and TSL lines as normal.
But this is short lived as price falls immediately under the red AMA line and a Sell trade is placed along with its customary TP and TSL lines.
Price continues to fall and activates the TP line.
Trade is closed Profit secured.
As no trade is in progress the EA opens another Sell trade as per Time clock rules until the time deadline runs out and closes the trade for that day.