Spezifikation
Dear Developer community,
I have developed a couple of custom indicators that I want to use in a trading ea. I don't have enough time to develop the ea myself, so I need your help. There is nothing special in the ea that I want, just requires prior experience in lot handling in mql4 that I do not have.
Here is what I am looking for: EA takes from custom indicators several informations:
- No signal, Buy or Sell signal (-1, 0, 1), trend status (1 = bullish, -1 = bearish), age of current trend (x integer = number of bars) and Stop Loss (market value).
EA checks the parameters below and trades.
Parameters:
1) Buy / sell lot allocation coefficient .
if the buy coefficient is equal to 0, that means no buy signals should be taken.
if the buy coefficient is queal to 1, that means buy signals should be executed with calculated lot size times 1 (no change).
if the buy coefficient is queal to 1.5, that means buy signals should be executed with standard lot size increased by 1.5 (+50%).
Same thing for sell signal. Default is 1 for buy and 1 for sell.
2) Maximum size of SL to enter a trade.
It is the maximum size of SL in pips allowed. For example if this parameter is set to 100 pips, any signals with SL>100pips will be ignored.
There should be two parameters: default value and time window dependant value (time window parameters).
For example, parameter default SL max is equal to 40 pips, but if server time is in between 9:00 to 11:00 take signals only if SL size is inferior 50 pips.
3) Lot size calculation mode parameter:
- Fixed % of account size. For example: 2%.
- Fixed lot size. For example 0.1 lots.
- Fixed % of account size normalized to stop loss size.
Example1: 10% of 10000 USD account = 1000$, if SL=200 pips and currency pair EURUSD, Lot size = 0.5 Lots
Example2: 10% of 10000 USD account = 1000$, if SL=100 pips and currency pair EURUSD, Lot size = 1 Lots
4) Martingale Table of Coefficients:
if previous trade was a loss (or stop loss set to zero and hit i.e zero profit), then increase lot size by this coefficient.
if previous trade (zero profit) and the one before were losses (or zero profit), then increase lot size by this coefficient.
Etc... This is basically a table with 20 parameters.
5) Take Profit Table of Coefficients:
All the parameters in this table are measured relative to the stop loss size in pips.
For example: SL=100 pips, position size = 1 lot.
Take profit 1 = Open price + 0.5*SL = Open price + 50 pips.
Percentage of position allocated to take profit 1 = 75% = 1*0.75 = 0.75 lots
Take profit 2 = Open price + 0.75*SL = Open price + 75 pips
Percentage of the remaining position allocated to take profit 1 = 50% = (1-0.75)*0.5 = 0.25 * 0.5 = 0.125 lots = 0.13 lots (round).
Take profit 3 = Open price + 100 pips
Percentage of the remaining position allocated to take profit 1 = 100% = 0.12 lots.
This is a table should have 15 take profit levels: each level has two parameters: distance from open price in number of SLs and percentage of position allocated to take profit.
if the minimum remaining size lot cannot be divided then close the entire position on take profit level.
6) Stop loss managment:
Koef 1, new SL level1 : if current price has reached open price + koef1 x stop loss (initial stop loss), then move SL to open price + SL level1.
Koef 2, new SL level2 : if current price has reached open price + koef2 x stop loss (initial stop loss), then move SL to open price + SL level2.
For example: koef 1 = 1 and new SL level1 = 0, SL = 30 pips, open price = 1.2750,
if current price = 1.2750 + 30 pips = 1.2780 then move stop loss to open price = 1.2750, basically to zero.
This example assumes buy position.
7) Head fake management:
This is a switch: either ON or OFF.
If ON, then if we have a buy signal, and the stop loss is hit but the trend did not change, wait for new bullish candlestick (close>open), and open a new position with SL = low of the candlestick.
The same for a sell signal.