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% / 46%
Caducado
12
27%
Libre
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
(257)
Proyectos
419
38%
Arbitraje
86
44% / 19%
Caducado
71
17%
Ocupado
6
Desarrollador 6
Evaluación
(8)
Proyectos
10
40%
Arbitraje
0
Caducado
0
Libre
Solicitudes similares
The overall goal is to develop a backtester for external binary options indicators that give output buffers (arrows) for signals that will reveal the most profitable expiration times and what hours are best to trade. I want you to deliver the source code and I retain rights to the code. I want to discover for example on a 5min chart whether 1 minute, 2 minute or 8 minute, etc expiration time is most profitable. I
Life Creator 40 - 1000 USD
the topic of this robot is ,,life creator'' becouse when you have no idea what to do, this robot can help you and teach you how you can do it. The robot gonna creat you your own tactics which can help you in future. When you gonna see that it's really work you start to be happy and you gonna want to have more of this
I need ea that based on point and finger chart formula point and finger chart does not follow time frame only price based and point and finger chart has same functions as given below source > HL/close box size assignment method > traditional reversal > 1 or given as request box size > 0.00 lot size > 0.00 trailing stop in box > one box behind or as given must not follow time only price based X
I need the following modules as per this sample indicator, then integrated with RSD Candles. look into the sample input settings, ................................................. ......................................................................................................... .......................................................................................................... ................previous
You need to be able to convert the IBS Indicator which is written like this in ProRealCode: r = max(range,0.0001) ibs = (close-low)/r Also, you need to be able to convert the Momentum indicator written like this in ProRealCode: https://www.prorealcode.com/documentation/momentum/ Return value of the Momentum technical indicator of the Nth bar : (close – close of the N-th last bar). 1 Momentum [ N ] Calculation: It is
Hft live account 30 - 200 USD
i need a high frequency trading (hft) expert advisor, that can be used to trade on demo and live accounts icmarket and 8cap. The EA has to be highly profitable, giving daily profit. If a test version is available, please send, to foster a faster transaction. like the ones that pass prop firm and demo but adjustment where it work on live with low latency
Hello [Programmer's Name], I hope this message finds you well. I am seeking your expertise to develop a forex Expert Advisor (EA) capable of identifying trading opportunities based on crossover signals from the following indicators: - MACD - RSI (including Connor RSI) - Stochastic RSI - Stochastic - Moving Averages (MA) with periods: 5, 10, 20, 50, 100, and 200 Key requirements for the EA include: - Integration of
Hello, i need a robot for gold trading being able to determine a trend or instant changes on a micro scale so its just going to scalp very fast but, for example lets say we have an equity of 500 bucks it needs to take profit at 5 and open a new position and just continiue going like that all day, but i also want it to determine buying opportunities based off of a very wide range of candlestick data of gold the day
CPI ROBOKING 30+ USD
*Strategy: CPI-Based Trading* *Instruments:* XAUUSD (Gold), UsTech100 (Nasdaq 100), USDJPY *CPI Release:* 1. *Higher-than-expected CPI:* - XAUUSD: SELL (Gold prices may drop due to potential rate hike) - UsTech100: SELL (Tech stocks may drop due to potential rate hike) - USDJPY: BUY (USD may strengthen due to potential rate hike) 2. *Meets or lower-than-expected CPI:* - XAUUSD: BUY (Gold prices may rise due
Hello, I have an EA already created and what I require is a modification to the code so that when a backtest is executed, it generates a CSV file with custom data that I want to extract to perform an analysis of the backtest operations

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)