EA "BUYBID_SELLASK_ASSISTANT" //Basic introductory information Platform: MT5. Products: EA must work with all offered products in the platform. Broker compatibility: it must work with all MT5 brokers, initial broker will be IC Markets. Chart time frames: EA must work on all timeframes from Monthly to 1 min. EA working period: it must work also overnight and over the weekend if needed. MT5 indicators used: Average true range and Donchian channel, indicators do not have to be displayed on the chart. Both indicators are built into MT5. Account types: EA must work with Netting mode account. If you don't know what this is please don't take over this project. Also, keep in mind that orders with IC Markets can be put inside the spread even, or a sell limit order at ask price and a buy limit order at bid price. If you don't understand these possibilities, please don't take over this project. In a Netting mode account, only one instance of EA can run per instrument to avoid confusion. How it works? I will open a trade manually. then I will open a chart of that instrument and select a desired time frame. This selected chart time frame is key information for EA to work properly. For example, EURUSD long 0,03 is opened - then I will open EURUSD chart with 120 min time frame. Then I will attach EA to that specific time frame. EA will focus only on exiting an existing trade - ideally in three parts if trade size would allow. Below is a table on how size shall be distributed on each of the three exits. We will call first exit COVER 1, second exit COVER 2 and third exit COVER 3. If trade size is to small to be split across multiple exits, we will only do Cover 1 exit, or maye Cover 2 also, as per table below. Size splits for exits If trade size COVER 1 COVER 2 COVER 3 1 unit 1 2 units 1 1 3 units 1 1 1 4 units 2 1 1 5 units 2 2 1 6 units 2 2 2 7 units 3 2 2 8 units 3 3 2 9 units 3 3 3 10 units 4 3 3 etc. Meaning if only 1 minimal unit is opened and EA cannot exit a trade in three parts, we will cover the whole position on COVER 1 exit rule only. If there are 2 units opened, we can exit half on COVER 1 and half of the position on COVER 2. If we have 3 units opened we can now also include COVER 3 exit as per the table above. I hope there is a logic in the table above so that it can be used even with different sizing but the same logic. This table above does not set the rules for EA on how to exit, it is just a guiding tool for sizing. Rules for exits are described below. Also, all the inputs marked with three stars *** below shall be available for me to modify. //RULES FOR EXITING A TRADE LONG EXAMPLE I will enter a trade manually. EA shall modify existing stop loss to 1.5*** ATR (14) immediately (based on that chosen chart timeframe) or set this stop loss if not set already manually. If market moves below entry price after 5*** bars (entry bar is bar 1) exit trade "at market". This TIME LIMIT rule governs all the rules below (Cover 1, Cover 2, Cover 3). COVER 1 exit rule: wait 2*** bars to close (entry bar is bar 1) and then put a pending sell limit order for a proper trade size (see sizing table above) at the high of 2*** bar Donchian channel (value taken from last closed bar). Since chart drawn in MT5 is bid price it means if this 2*** bar Donchian channel high is 88 bid, you immediately put a sell limit order at 88. This also means that this pending order may move over the following bars if Donchian indicator moves. Once this order is filled (if filled of course, stop loss may also close the trade or a TIME LIMIT rule), reduce stop loss by 30%***. COVER 2 exit rule: wait 2*** more bars to close (cover 1 exit bar is bar 1 now) and then put a pending sell limit order for a proper trade size (see sizing table above) at the high of 4*** bar Donchian channel (value taken from last closed bar). Since chart drawn in MT5 is bid price it means if this 4*** bar Donchian channel high is 84 bid, you immediately put a sell limit order at 84. This also means that this pending order may move over the following bars if Donchian indicator moves.. Once this order is filled (if filled of course, stop loss may also close the trade or a TIME LIMIT rule), reduce stop loss by 80%***. Note: Cover 2 exit rule can only start if Cover 1 exit rule is executed. COVER 3 exit rule: use trailing stop loss to close the balance of the position. Capture 66%*** of all floating profits since the trade was opened (we will need to monitor largest floating profit on the trade for this to work, I assume). Note: Cover 3 exit rule can only start if Cover 2 exit rule is executed. Special exit rule that overrides COVER 1, 2, 3 rules is "IMPULSE EXIT": If trade shows a profit of 3ATR*** before C1 is reached, trail stop loss on the complete position by 80%***, meaning we need to capture 80% of maximum floating profit on the trade since trade was opened. This IMPULSE EXIT shall have enable/disable option in EA settings. SHORT EXAMPLE - Rules are basically the same just vice versa. I will enter a trade manually. EA shall modify existing stop loss to 1.5*** ATR (14) immediately (based on that chosen chart timeframe)or set this stop loss if not set already manually. If market moves above entry price after 5*** bars (entry bar is bar 1) exit trade "at market". This TIME LIMIT rule governs all the rules below (Cover 1, Cover 2, Cover 3). COVER 1 exit rule: wait 2*** bars to close (entry bar is bar 1) and then put a pending buy limit order for a proper trade size (see sizing table above) at the low of 2*** bar Donchian channel (value taken from last closed bar). Since chart drawn in MT5 is bid price it means if this 2*** bar Donchian channel low is 24 bid 26 ask, you immediately put a buy limit order at 26! This also means that this pending order may move over the following bars if Donchian indicator moves. Once this order is filled (if filled of course, stop loss may also close the trade or a TIME LIMIT rule), reduce stop loss by 30%***. COVER 2 exit rule: wait 2*** more bars to close (cover 1 exit bar is bar 1 now) and then put a pending buy limit order for a proper trade size (see sizing table above) at the low of 4*** bar Donchian channel (value taken from last closed bar). Since chart drawn in MT5 is bid price it means if this 4*** bar Donchian channel high is 18 bid 20 ask, you immediately put a buy limit order at 20. This also means that this pending order may move over the following bars if Donchian indicator moves.. Once this order is filled (if filled of course, stop loss may also close the trade or a TIME LIMIT rule), reduce stop loss by 80%***. Note: Cover 2 exit rule can only start if Cover 1 exit rule is executed. COVER 3 exit rule: use trailing stop loss to close the balance of the position. Capture 66%*** of all floating profits since the trade was opened (we will need to monitor largest floating profit on the trade for this to work, I assume). Note: Cover 3 exit rule can only start if Cover 2 exit rule is executed. Special exit rule that overrides COVER 1, 2, 3 rules is "IMPULSE EXIT": If trade shows a profit of 3ATR*** before C1 is reached, trail stop loss on the complete position by 80%***, meaning we need to capture 80% of maximum floating profit on the trade since trade was opened. This IMPULSE EXIT shall have enable/disable option in EA settings. //EMAIL REPORTING EA shall send an email for execution of the any order (stop loss, time limit, trailing stop, cover 1, 2, or/and 3) and the message shall be like this sample: "EURUSD order 0,01 buy limit filled at 1.0020" //IMPORTANT Please note that there may be some time in between I open a trade manually and until I put EA on a chart. EA shall allow to be put to work at least 1 bar after entry bar and it shall still do all the operations above properly.