Lavoro terminato
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Specifiche
I need a very simple EA which:
1- Should work on three indicators (Moving Average, Parabolic SAR, MACD and Fractals). The option to turn on/ off for these indicators should be available for the trader as per his strategy. Of course, if the trader wants to turn on one/ two/ three indicators, further options to determine the type/ values (I.e Parameter) should be asked by the EA.
2- The system works on top/ bottom (Fractals) and signal produced by the indicator either it be SMA, EMA, PSAR, MACD or combination of any two or three. A signal produced by an indicator means when it changes its stance (from buy to sell or vice versa).
3- When Fractals=on; MA=on; PSAR=off; MACD=off. Buy when a lower fractal appears and the price is already above MA or price just crosses at second candle after a lower fractal. (Of course a fractal is considered final after formation of two candles after it). The vice versa is true for placing sell orders.
4- When Fractals=on; MA=off; PSAR=on; MACD=off. Buy when a lower fractal appears and the price is already above PSAR or PSAR just appears at second candle after a lower fractal. The vice versa is true for placing sell orders.
5- When Fractals=on; MA=off; PSAR=off; MACD=on. Buy when a lower fractal appears and the MACD is already showing upward bars or buy signal or MACD just gives buy signal at second candle after a lower fractal. The vice versa is true for placing sell orders.
6- When Fractals=on; MA=on; PSAR=on; MACD=off. Buy when a lower fractal appears and the MA and PSAR are already showing buy signal. The vice versa is true for placing sell orders. The same mechanism should work for other combination of indicators.
7- When the indicator/ combination of indicators produces an opposite signal, the running trade shouldn’t be closed, instead, an opposite side trade of equal running lot should be placed to compensate the running trades in opening directions. Of course, another trade should also be placed as explained above. For example, if the price is above MA and 5 buy trades (each of lot size 1) are running and an upper fractal is formed and price suddenly crosses MA downwards, the EA should immediately place 1 sell order of lot size 5 to hedge the buy trades. However, this change of signal should only be determined by one Master indicator and that would be determined by the trader in EA settings and will be one of the (MA/ Fractals/ PSAR or MACD). On the other hand, it should also place a selling order (since a sell signal has also been generated by fractal and MA in this case) of lot size x should be placed. The lot sizes for these new trades are explained below.
8- The field ‘Stop loss’ should be of two types:
i- Fixed
ii- Top bottom
i- The fixed stop loss is just fixed number of pips away from the opening price of the trade as mentioned by the trader.
ii- ‘Top bottom’ stop loss is the stop loss ‘x’ number of pips above or below the latest top/ bottom. The number of pips ‘x’ will be mentioned by the trader. For example, If the trader inputs ‘5’ for a buy stop, the stop loss of this trade will be 5 pips below the last bottom. S/L type ‘Fixed’ and stop loss distance=0 means no stop loss for the trades.
9- The ‘take profit’ should be of three types
i- Fixed
ii- Top bottom
iii- Trailing
i- The fixed take profit is just fixed number of pips away from the opening price of the trade as mentioned by the trader.
ii- ‘Top bottom’ take profit is ‘x’ number of pips above or below the latest top/ bottom. The number of pips ‘x’ will be mentioned by the trader. For example, If the trader inputs ‘5’ for a buy stop, the take profit of this trade will be 5 pips above the last top. If the trader inputs ‘-5’ for a buy stop, the take profit of this trade will be 5 pips before the last bottom Hence, the take profit of buy orders will be x pips above/ below the latest top and the take profit of sell orders will be x pips below the latest bottom. Please note that unlike stop loss, top bottom take profit can have a negative value as it will imply the price hit x pips before the latest top/ bottom.
iii- ‘Trailing’ take profit is simply trailing and should work like a common trailing take profit with number of pips inputted by the trader in EA settings.
10- There should be a field named as ‘Lot Type’ with the option to choose as ‘fixed’ and ‘Variable’. If the traders selects ‘Fixed’, the next field named as ‘Fixed Lot Size’ should take input of standard lot size from the trader and place each trade of that lot size. In case the Lot type is selected as ‘Variable’, then EA should refer to the next field named as ‘Maximum loss- Capital’ in the EA where the trader will write an amount of capital to be risked in the trade and hence the EA should calculate the lot size accordingly. For example, opening price of a long trade in US30Cash is 33930 after the formation of bottom at 33900. This is difference of 33930 – 33900 = 30 pips. Suppose, we have written an amount of 100$ in the maximum loss field. Hence the lot size should be calculated as 100/30 = 3.33$/ pip. If the trader selects ‘0’ in this field, the EA should look on the next field ‘Maximum Loss Percentage’.
11- Another field named as ‘Maximum Loss Percentage’, as depicted from the name is simply the percentage of the capital which should be risked per trade. For example, If the trader writes 1 here and my capital is 10,000$, the maximum loss should automatically be considered 1% x 10,000 = 100$ and the lot size should be calculated accordingly. The max value of this field should be 10. If I select ‘0’ then the above field ‘maximum loss-Capital’ should be considered in this case.
12- There should be a filed named as ‘Max Running Lot’. Max Running Lot is used to limit Maximum opened Lot Size of all running orders in a unit lot (Standard/ Mini/ Micro) (total sum of all lots of running orders). For Example, if I select 1, the EA should keep placing orders until sum of lot sizes of all running orders reaches upto 1 standard lot max. This control is introduced to limit massive running lot sizes and infinite number of orders during large trends.
13- The last field named as ‘Close orders’ will be of two types.
i- Close all orders
ii- Nil
i- If the trader selects ‘Close all orders’, EA should close all running and pending orders and halt further trading until this field is selected as ‘Nil’.
ii- ‘Nil’ means that this field should not work.
14- The last three fields named as ‘Profit stopper’, ‘Loss stopper’ are used to protect/ avoids profits/ losses of running trades and work simple. I.e; if the trader mentions 200 in the ‘Profit Stopper’ the EA should close all running trades (instead of whether they are in profit or loss) when the total of running trades reaches 200dollars (or the account currency). Similarly, if the trader inputs -200 in ‘Loss Stopper’, EA should close all running trades if the total loss of all running trades becomes -200 or lower. When these fields are zero, it shouldn’t work.