Martingale on a Moving Average strategy. Adding the feature on an existing EA

Tarea técnica

Modify an existing moving average crossover EA

 

We need two things to be done in our existing and functioning EA for MetaTrader 4. 

 

1.          Adding a feature that offset losses

2.          Adding brokers’ commissions cost to the EA

 

1. Offset losses

 

The existing EA, buys and sells as explain on the document attached, called “moving average strategy”.

 

Our intention is to add a feature that is triggered when a trade make a loss. The objective is to cope with the losses generating more trades, a kind of “Martingale strategy”. 

 

Bullet points

 

·       The strategy tries to offset the loss trades, generating more trades.

·       It can generate one or more trades to cope with the losses of a trade.

·       We may want to generate more than one trade to cope with the losses of a trade.

·       Those trades that are generated to offset loss trades, can generate more trades. In classic martingale, your next trade will try to cope with your previous trade loss, here we will divide in X trade to cope with the loss.

·       Be able to choose how many trades are open every time.

·       On report, we will need to be able to see how many trades still to be open. So, it needs to save information of pass trades and pending trades.

 

Parameters

 

Loss trade divided: 0 means the feature is off. 1 to XX, it will divide the loss trade in XX future trades, if parameter is 5, it will generate 5 consecutive trade to cope with the loss.

Active trades: At some point we would like to choose how many trades the EA opens. If 0, unlimited if above 0 whatever it says. With this parameter you limit the trades the EA generate every time, as market conditions could make the EA to generate lots of trades in a matter of MA crosses.

 

 

 

 

 

On report

 

On report we need the following figures;

 

Number of trades still to go in case we limit the active trades.

Value of the trades to go.

Number of trades trading.

Value of the trades trading.

Sum of commissions.

 

A compressive case

 

See on photo attached, 3.png

 

First column, called CROSS, this is when a MA cross the EA generate an order.

Second column, called profit main trade, it is simple the main trade the EA does when MA crosses, to make it easy I choose take profit on 4 pips $60 and 40 pips $600.

Third column, called loss trade trigger is a reference of each main trade that goes to losses.

Then the one called profit and loss, is a simple sum of each trade.

And the last one equity, this is the net deposit.

 

Those this exemple we hae used this parameters

 

Loss trade divided by: 10

Active trades: 0

 

So, it will dived the losses by 10 and it will allow the EA open as much trades as the MA and losses dictates.

 

1.      Cross 1 goes wrong and loss money, $600. The EA will generate 10 trades for the next Crosses to cope with loss of Cross 1, and the calculations for the next 10 trades goes as follows $600/10 + target profit / 10. This trades is 1.1.

2.      On Cross 2 the EA will generate two trades, the main one and a second one that tries to cope with losses of trade on Cross 1, trade 1.1. 

3.      Cross 3 the EA will generate two trades, the main one and a second one that tries to cope with losses of trade on Cross 1, trade 1.1.

4.      Cross 4 the EA will generate two trades, the main one and a second one that tries to cope with losses of trade on Cross 1, trade 1.1. As it goes wrong, the EA will generate trade 1.2 and 2.1, those two trades will try to cope with losses of trade 1.1 and main trade of cross 4.

5.      Cross 5 EA wil generate 4 trades Main trade plus 1.1, 2.1 and 1.2.

 

 

 


 

 

 


2. Adding brokers’ commissions cost to the EA

 

We need a parameter to be able to define commissions. 0 means no commissions, and then euros per lot.

Archivos adjuntos:

PNG
1.png
229.0 Kb
PNG
2.png
232.4 Kb
PNG
3.png
335.1 Kb
PNG
4.png
44.7 Kb
PNG
1_MA.png
257.3 Kb
PNG
2_MA.png
353.7 Kb
PNG
3_MA.png
591.5 Kb

Han respondido

1
Desarrollador 1
Evaluación
(137)
Proyectos
167
35%
Arbitraje
11
91% / 0%
Caducado
0
Libre
2
Desarrollador 2
Evaluación
(23)
Proyectos
45
20%
Arbitraje
24
29% / 42%
Caducado
12
27%
Trabaja
3
Desarrollador 3
Evaluación
(62)
Proyectos
140
46%
Arbitraje
19
42% / 16%
Caducado
32
23%
Libre
4
Desarrollador 4
Evaluación
(3)
Proyectos
1
100%
Arbitraje
1
0% / 0%
Caducado
0
Libre
5
Desarrollador 5
Evaluación
(250)
Proyectos
399
38%
Arbitraje
82
41% / 20%
Caducado
69
17%
Ocupado
6
Desarrollador 6
Evaluación
(8)
Proyectos
10
40%
Arbitraje
0
Caducado
0
Libre
Solicitudes similares
Hello Great Developer. I have a HFT bot for mt4. Can you copy it for ctrader? I will be looking for a Great Developer to bid for it and let talk about it now
How are you today? We’re looking for a ctrader bot that can receive signals from tradingview and place orders on different ctrader accounts, so no strategy coding is required. Here are the details: https://www.loom.com/share/d8166c67a74f46c28920be9e131f8ec7?sid=bd2c6ff2-52e4-4355-b35f-f4fc1bfb0f3b&nbsp ; We would like to know from you what’s the most cost effective method to create this bot. PDF is also attached to
Due to the complicity of the strategy on the first two orders I madeI had to create another one with a simple strategy cos many can't create what I'm asking for...Example: : When The market is buying and rejects an has created an M formation the First leg is higher than the second leg(first leg Higher high,second leg lower high then a line must touch the peak of the Higher high then connect with the peak of the lower
The modification needed on this autotrade robot is simple. I want the bot to close an opened position in a specified period of time when price fails to hit the take profit. Think of it as a timed stop loss instead of the regular known pip stop loss. A working demo version will be requested to show me you have successfully made the revision
Requirements for programming a custom Expert Advisor (EA) for MetaTrader 5 (MT5) Summary: The following requirements describe the features and functionalities that the custom Expert Advisor for MT5 should have, including integration of functions from the POW Banker EA, trade closure options, filter and signal configuration, control panel, and specific protections. Integration of functions from the POW Banker EA: a
i mean i have this indicator(it's made for tradingview) but i would like to be using it in mt5, that's to change from pinescript code to mql5 code so that i can install it in mt5. and i want it be working in mt5 exactly the way its working in tradingview
Hello there, I have a script on tradingview pinescript that I need to get it converted to mql5 and add trailing loss, the script is very simple and not too complex. I will share the script with you once you bid. Thanks
Create MT5 Indicator 30 - 40 USD
Hi there, I trust you are well. Could please kindly create an MT5 indicator that shows points lost and current trade running time, separated by a vertical bar. Color choosing options both for the points lost, vertical bar and trade running time. Indicator position on any corner of the screen and X and Y position adjustable. The points lost: Should apply to the current symbol only. It must not look at history trades
i only trade on gbpusd using a supply & demand combined with M & W patterns. entry criteria for a buy would maily consists of price being at a support of round number price example: 1.23000 , 1.23500, 1.24000 & so fourth as long as it is around a round price with a difference of 500 points or 50 pips with a stoploss of a maximum 25 pips e.g entry price will be at a round number of say maybe 1.23000 as an example and
I want to develop a fully automated trading robot from scratch. The project includes 8 different pdfs + an introductory instruction pdf. Different pdf deals with different Settings of the EA and/or different St (trading strategies/logics). All Settings & St are to be housed in a single MQL5 EA. The EA is to be attached to a single chart, but it must work on every chart of 63 symbols at a time without any failing or

Información sobre el proyecto

Presupuesto
70 - 120 USD
IVA (21%): 14.7 - 25.2 USD
Total: 84.7 - 145.2 USD
Para el ejecutor
63 - 108 USD
Plazo límite de ejecución
de 5 a 7 día(s)