작업 종료됨
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
명시
Input parameters
T1 - time of daily start of EA (terminal time)
T2 - time of daily stop of EA (terminal time) - at T2 all open orders to be closed
AO1 - Awesome Oscillator level, set at positive number. For Buy orders taken with negative sign
targ - take-profit, added to Open price of candle when the order was placed, for Pending orders added to PriceBL (see below)
loss - stop-loss, added to Open price of candle when the order was placed (set as negative number), for Pending orders added to PriceBL (see below)
step2 - price step for Pending order set up. Positive number.
contr - number of contracts to buy/sell
! Open price of candle when order was placed = open price of candle NOT price at which we buy/sell (see pic open candle price)
Buy Check
If AO<AO1 level at candle close check if it is the first order of today then go to Buy Order,
If not check if there are any open orders - if there are open orders do not go further
If no open orders check if previous order was also Buy Order - if it was Buy check if Awesome Oscillator crossed zero-line after previous order (see example picture zero-line crossing for Sell order). If zero-line was crossed or previous order was Sell go to Buy Order
Buy Order
Buy at market for fix number of contracts, take-profit price = open price of candle when order was placed +targ, stop-loss =open price of candle when order was placed +loss
Buy Limit
After opening Buy order open pending Buy limit. PriceBL= price of initial Buy order described above - step2, Take-profit = PriceBL +targ, Stop-loss = PriceBL+loss
If pending order is activated (order is opened) then change take-profit in initially opened Buy order to the take-profit of Buy Limit order (NO change of stop-loss)
If pending order not activated but initial Buy order closed at profit then delete pending order
Sell
same logic - Sell Check, Sell Order, Sell Limit mirrored from Buy
- Add button on the screen (graph of instrument) which allow to start/stop EA
- On graph of the instrument when buy or sell order opened draw a circle (standard object code 108) above the candle of order open in blue color
- On graph of the instrument when buy or sell order closed draw check mark (standard object code 252) above candle in Green color for take-profit in Red color for stop-loss
- Code should include very text comments for each step of logical sequence of operations (checking of conditions of presently open orders, crossing of zero-line of Awesome Oscillator, change of take-profit etc. as per logic)