Spezifikation
Expert advisor should work on MT5. Source code should be given and code should be modular and well documented in each block. EA will be attached to any 1 single symbol chart but it will run all all the symbols and timeframes that are specified in the Input. Each Timeframe(s) and Symbol combination will have a separate and unique magic number. That number and timeframe combination and symbol and pattern name (DBR, RBR, DBD, RBD) should be displayed on the screen in the table as a summary if a trade or pending order related to that is open currently. Chart will use candlestick chart.
Definition
Unfilled Boring/Base candle: A candle where body of candle is less than 50% of the total length of the candle. Also the TR of this candle will be less than the ATR of this candle. ATR calculation is taken of last 14 candles. If multiple consecutive boring candles are present then rules will be applicable on all of those.
Filled Leg-in candle: Candle that comes just before the first Boring Candle, its Body should be more than 50% of its own total length and its TR should be greater than its ATR. ATR calculation is taken of last 14 candles. It should be bigger than the Boring candles that come just after it.
Filled Leg-out candle: Candle that comes just after the last Boring Candle(if there are multiple Boring candles then), its Body should be more than 50% of its own total length and its TR should be greater than its ATR. ATR calculation is taken of last 14 candles. It should be bigger than the Boring candles that come just before it. The length of the candle starts from the close price of the last boring candle and ends at the high/low price of the Single leg out(high for Demand zone buy trade and low for Supply zone Sell trade) candle or ends at the high/low of the 3rd legout candle if 3 consecutive green/red candles are present.
Inputs:
1. Candlestick Timeframe Selection: 1 Min, 2 Min, 3 Min, 5 Min, 15 Min,30 Min, 1 Hr, 2 HR, 3 Hr, 4 Hr, 8 HR, 1 Day, 1 Week, 1 Month. Multiple Selection checkbox.
2. Symbol Selection: Comma separate list of Symbols to be accepted as Input. Multiple Symbols can be entered.
3. Ratio of Base/Boring Candle to Legin Candle: example 1:2, 1:3 etc accept the ratio in textbox, If there are multiple Boring candles all should adhere to this ratio.
4. Ratio of Base/Boring Candle to Legout Candle: example 1:4, 1:5 etc accept the ratio in textbox
, If there are multiple Boring candles all should adhere to this ratio.
5. Maximum Number of Base/Boring Candles Allowed: Textbox that allows Number from 1 to 4
6. Minimum Leg In Body To its own HighLow % : Accept percentage as a number so if we enter 60 then it means the body of the candle should be atleast 60% of the total length of that candle including the wick(high and low also). Optional paramter. Leg in candle is the Candle which is just before the Base/Boring Candle(s). If there are multiple boring/base candles then the candle which comes just before the first boring candle is called as Leg in Candle.
7. Minimum Leg Out Body To its own HighLow % : Accept percentage as a number so if we enter 60 then it means the body of the candle should be atleast 60% of the total length of that candle including the wick(high and low also). Optional paramter. Leg out candle is the Candle which is just after the Base/Boring Candle(s). If there are multiple boring/base candles then the candle which comes after the last boring candle is called as Leg out Candle.
8. Number of consecutive candles to consider for Leg-out length calculation: Optional Parameter that accepts a number. Suppose if we select 3 then that means after the Boring candle or the last of the boring candles if 3 consecutive green or red candles are created those would be considered as a single leg out candle and the length of the legout candle will be considered as the total of these 3 candles. If this parameter is selected then point 8 calculation will also consider this as the total length for its calculation.
9. Number of Fix Lots: Example 0.03, 0.06 etc.
Logic of the Expert Advisor. The EA will detect if any of the 4 patterns shown in image below have been created by candles that have closed earlier and place pending limit order on Proximal Price and the Stop Loss will be the Distal Price+/- few pips(few pips buffer is config value that will be given in Input). For Buy Trade the Stop loss will be slightly below the Distal price and for sell trade the Stop loss will be slightly above the Distal Price. The First Take Profit will be 1:5, Second Take Profit will be 1:10 and Third Take Profit will be 1:15, fourth take profit will be 1:20 and so on(The TP levels are linked to number of lots so if lot size is 0.04 then we take till TP4). Stop loss will be same for all. When initial 1:5 TP level is achieved then set the other remaining lots to breakeven level. if only 0.01 lot is given then a fix TP of 1:5 will be there 1 Risk(SL) and 5 times reward.
Buffer in Pips for Distal: accept number, optional parameter
Buffer in Pips for Proximal: accept number, optional parameter
The Area or zone between the Proximal and Distal price should not be tested by Price after it has been created. If price has already come between this zone earlier after this zone was created then Pending order should not be set for Buy or Sell. Only when the zone is fresh and untested the Pending limit orders can be set. Remember that the Legout candle is excluded from this check as it can come within this zone also. But all the candles that are created after Legout should not have come within this Area zone in between the Proximal price and the Distal Price. The candle that comes just after legout candle should not cover more than 50% of the Legout candle.
Other rules
THERE SHOULD BE NO GAP IN LEG-IN AND BORING CANDLE(s)