Работа завершена
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Техническое задание
Hello, I would like you to make me an expert advisor, that will take trades based on an mt4 indicator called envelopes.
So, I would select a price on the chart and direction, and input it in the EA, then the EA would run two conditions;
1) Did the candle close at or above/below the price that I entered
2)Did the candle close outside the envelopes?
So, depending on the direction and price that I put into the EA, the EA would take a trade.
The stoploss will be the lowest price or highest price of the candle that meets this conditions.
So the EA will look like the picture I attached.
The price, is the price that I will enter manually.
The buy/sell is the direction I will select.
The timeframe is the specific timeframe that I want the particular order to work on.
Envelopes parameter is the parameters of the indicator that I should be able to change, just like the normal indicator.
Bankroll management is the percent of my account that I want to risk per trade. This can be less than 1%.
Number of attempts is the number of times that the EA has taken a trade on that order but the stoploss has been hit.
For example, the usd/cad chart that I attached, I entered a price of 1.3080
For buy or sell, I selected buy
For timeframe, I selected 15 minutes
For envelopes parameter, I put in Period: 16 and Deviation: 0.08%
For bankroll management, I put in 0.5% of account per trade.
So I clicked start, then EA would start checking until the conditions are met.
For this particular trade, the EA would take a trade at the first pink arrow because the candle closed above 1.3080 and also closed above the envelope. The stoploss would be the lowest price of the candle. The first trade failed because stoploss was hit.
Then the EA would take another trade at the second pink arrow because the candle closed above the price and envelope. The stoploss will be the lowest price of the candle. As you can see, the second trade is in profit.
The number of attempts in this trade is 2.
Also, if the trade reaches profit of 2 times risk, then change stoploss to break even price.
I would like an alert if the number of attempts for a particular order reaches 5. Also an alert if the profit reaches 5 times risk.