Class-driven Averaging Subroutine - position averaging function, opening positions against the trend

MQL5 Asesores Expertos

Trabajo finalizado

Plazo de ejecución 43 días
Comentario del Ejecutor
Great customer. Clear instructions. Thanks. Look forward to more jobs in the future.

Tarea técnica

Develop a class-driven sub-routine that can be implemented in a variety of existing Expert Advisor with minimum complications of integration. It should implement a good OOP concept for reusability and derive sub-mechanisms.

This sub-routine will work on algorithms running on MT5 terminal; we may need to develop an expert advisor opening a long or short position for test. This subroutine purpose is to implement a strategy of averaging down.

This is that we open:

BUY 1 LOT EURUSD at 1.19209

This sub-routine will open automatically

BUY 1.3 LOT EURUSD at 1.19172 with a comment "Level_1"

Resulting on an average price in EURUSD of 1.19195 at 2.30 LOT, so this sub will draw a BLUE line at this average level. RED if SELL position.

Attention: For different LOT of positions, the average price is calculated using a mathematical formula.

Finally, will open automatically if the price continue against:

BUY 1.69 LOT EURUSD at 1.19078 with a comment "Level_2"

This next average level as is not open yet so will draw a line in "Bisque" color with the parameters of the averager sub-routine in this case the LOT factor increases to a 30% or 1.3X and the amount of PIPs in the following format:  1.30X/1.69N/94p indicating the average %, resulting lot size and pips in distance.

If this average level is triggered then the average price of the EURUSD position is 1.19145 at 3.99 LOT.

The PIPs difference between 1.19209 and 1.19172 and the next 1.19145 is provided as a parameter for the sub-routine.

The averager sub-routine will have a maximum amount of positions to open. And a FLOOR parameter that sets the minimum distance, this distance can be set in price or points. If in the example below we set a price floor of 1.19130 the next level provided can not be 1.19145 and will be floored at 1.19130. If we set a points floor of 70 pips the next level can not be 67 pips as provided and will be floored at 70 pips.

The subroutine will increase distance in the same way to increase volume, this is that an increment can be set of a 10% or 1.1X added to the distance provided.

If the instrument maximun volume is 50, and the next average down is 56. We will fraction the order in 50 (the max.) and another position at the same price level at 6, with the same comment. If the broker have a maxium limit of positions and can not open, we will pop-up a message alterting with the limitation of opening new positions. 

Finally, the sub-routine will use a time delay to evaluate if a different distance in pips is supplied.

Inputs:

AveragerFunc(
             bool AverageUSE=true,
             int Distance=1,
             ENUM MinDistType=1, //1-Price, 2-Points
             double MinDistVal=0,
             bool UseCalcDelay=true,
             ENUM CalcDelay=1M, //1M,2M,5M,15M,1H,1D,1W, TF defaults in example
             DistanceFactor=1.1, //points + 10% in this case
             LotsFactor=1.3, //volume + 30% in this case
             MaxOrders=10, //maximum of averaging positions
             string s="Averager " //default comment for opening positions and concatenate
             )

Output of the subroutine will be:
LOTs BUY:        2.3             //actual volume size
LONG Avg:       1.19195       //actual average
LONG N Avg:    1.19145       //next average

The average calculation have to take into account any commission and swap charges in any given period. So if this positions stays for more than a day and a swap is charged, have to be reflected in the resulting average price every day.

Attached an image of the horizontal lines.

Archivos adjuntos:

PNG
image2.png
10.6 Kb

Han respondido

1
Desarrollador 1
Evaluación
(27)
Proyectos
43
7%
Arbitraje
18
6% / 78%
Caducado
26
60%
Libre
2
Desarrollador 2
Evaluación
(169)
Proyectos
204
30%
Arbitraje
25
40% / 44%
Caducado
12
6%
Libre
Solicitudes similares
a coder is required to add an indicator to existing ea The new indicator will work as 1. option to combine with exiting indicator to open trade 2. it will be used as alternative BE point 3. It can also be used to close order or combine with other to close trade The second Job is telegram bot to get alert fr news trade and others Details when you apply i will test the ea work on live market and all bug is fixed before
Hello, I want to make an EA based on SMC and a developer that is familiar with the concept and full understanding of this. Must have done similar jobs before and be able show it. I only want to work with developer that has good track record and is precise. Further information will be handed when contact is made. Developers that has zero rating will not be considered. Listed price is a base point. The project can also
EA DEJA FABRIQUE ? MODIFIER QUELQUE LIGNE POUR LE RENDRE RENTABLE /////////////////////++++++++++++++++++++++++++++++++++ EA AVEC UN SYTEME SIMPLE ; SEULEMENT A MODIFIER %%%%%%%%%%%%%%%%%% SI PERSONNE SACHANT CODER CORRECTEMENT , CE TRAVAIL EST POUR TOI
Trade methodology based on Red and Green lines entering Overbought / Oversold zone. Using confluence of Higher time frame, Moving Average a trade can enter when there is a strong slope angle. Market Base Line is used to determine overall market sentiment. This is designed to be an established trend scalping strategy on lower time frames. To be used initially on demo then real account when settings have been fine
There are six conditions in total . source code from an existing expert will be provided to aid the completion of this job . - Install the following by the Panel (copy paste form my existing Expert ) 1. Pips Lost : number of pips lost ( monthly reset ) 2. Pips Gained : number of pips gained ( monthly reset ) 3. Have a black background to avoid the
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: function (A) Add Transform combine the 4 Expert Advisors into just 1 Expert Advisor, maintaining the individuality of each one Leave in extern (false) or (true)
Description: I am seeking an experienced MQL5 developer to create a custom Expert Advisor (EA) for MetaTrader 5 based on a specific trend-following strategy. The strategy includes precise risk management, advanced trade management features, and additional risk management tools. The EA should be adaptable to any timeframe on which it is attached. Below are the detailed requirements and parameters for the EA: Strategy
I need an EA trading frequently (HFT or something like), and it sould have some features below: 1、Have a clear trading logic 2、Have a good backtest result 3、Have a demonstrated benefitable result in a live account trading 4、Can avoid the news time period or not sensitive to news
Tenho um EA mql4 que está com funcionalidades funcionando e outras com funcionalidades sem funcionar. Tenho um vídeo do EA funcionando como deve funcionar perfeitamente. O meu não consegue seguir o mesmo programa pois quando coloca os pontos de parada e retirada são bem diferentes. Não tenho pressa para tempo, só queria que conseguisse renovar o EA. O arquivo do grafico anexo é como ele se encontra agora. O certo é
New york session based strategy 9:30 open Price takes out buy side or sell side liquidity Usually using 15min high and lows 5m entry Price takes out that high/low and price must close strongly back into the zone Is price is above price we have a sell bias vis versa for buys Sl is at the high or low with option for “offset” for cushion Tp is usually the opposite High or low. Would like the option for set pips-points &

Información sobre el proyecto

Presupuesto
150+ USD
Para el ejecutor
135 USD
Plazo límite de ejecución
de 1 a 10 día(s)