Write a function to calculate maximum lot size for the given percentage margin of risk

MQL5 Sripts Integración

Trabajo finalizado

Plazo de ejecución 1 día
Comentario del Cliente
Great work, thanks.

Tarea técnica

I need the following function to complete:

double GetMaxLotSize(int cmd, double sl, double risk_margin = 1.0, string symbol = NULL)

Arguments are:

- cmd: Command such as OP_BUY or OP_SELL.

- sl: Stop loss to calculate the lot size for.

- risk_margin: Account margin to risk (in %), e.g. Money = AccountBalance() / 100 * risk_margin (e.g. 1.0%)

-  symbol: If NULL, means current.

The output:

- Maximum safe lot size value to use where given SL won't exceed the percentage of risk margin amount.

This should work similar as GetMaxStopLoss() which calculates the maximum SL for given lot size, but GetMaxLotSize should work other way round.

The code should be compatible with MQL4 and MQL5. 

Han respondido

1
Desarrollador 1
Evaluación
(590)
Proyectos
789
71%
Arbitraje
9
33% / 33%
Caducado
22
3%
Libre
2
Desarrollador 2
Evaluación
(119)
Proyectos
127
41%
Arbitraje
3
33% / 67%
Caducado
0
Libre
3
Desarrollador 3
Evaluación
(97)
Proyectos
121
25%
Arbitraje
5
20% / 60%
Caducado
17
14%
Libre
4
Desarrollador 4
Evaluación
(133)
Proyectos
185
30%
Arbitraje
77
9% / 73%
Caducado
77
42%
Libre
5
Desarrollador 5
Evaluación
(39)
Proyectos
81
38%
Arbitraje
1
0% / 0%
Caducado
31
38%
Libre
Solicitudes similares
I have a License system for ea and indicator based on a wordpress plugin which uses a DLL to communicate with the license server. written in c++ The system works fine when running on newer windows OS from win 11 to win 8, but throws the error "Access violation read to 0x00000000" when running on older windows like window 7 and older vps like windows 2012 server R2. I need this issue fixed for the vps to work on all
I want to find a Developer to perform this work and settle payments in this Application. I undertake not to communicate with Applicants anywhere else except this Application, including third-party messengers, personal correspondence or emails. I understand that violators will be banned from publishing Orders in the Freelance service. I have read the Rules of using the Freelance service and accept them. I agree
ICT, SMC, PAMETNI NOVAC KONCEPTI, PAMETNI NOVAC, koncept pametnog novca, podrška i otpor, analiza trenda, radnja cijena, tržišna struktura, blokovi naloga, BOS/CHoCH, blokovi razbijača , pomak momentuma, zona ponude i potražnje/blokovi naloga , jaka neravnoteža, HH/LL/HL/LH, jaz fer vrijednosti, FVG, Zone premije i popusta , Fibonacci retracement, OTE, Likvidnost na strani kupnje, Likvidnost na strani prodaje
I'm looking for someone to help me implement the MetaQuotes web API in Laravel: - Create clients - Create users - Change passwords accounts - Create deposits and withdrawals I'm using a library, but it's only giving me problems
I need the following help wih the set up I have a TradingView paid license I have a script running in TradingView generating Alerts - see a screenshot example Then I have PineConnector which should be able to take those Alerts and deliver to MT4 And then there is MT4 installed with running PineConnector on it Yet somehow I cannot get those Alerts, including Trade set up, from TradingView to MT4. Please let me know if
Hello, I have an existing Expert Adviseo for Metatrader 5 that still contains a few errors. (The MQL5 code is present.) I would like to have these errors fixed. If necessary I would add a few more features to the EA
I need EA which can copy telegram signals to MT5 The EA should have the following 1. take profit 2. take loss 3. Break even 4. trailing stop 5. Stop trading if amount reaches 6. Accept buy stop , sell stop , sell limit and buy limit
I am looking for someone to help me to automate my trading from mt4/5 expert advisors and own trades to tradovate. My trades are generated by my expert in MT5, I want those trades copied to Tradovate's platform using their API to different accounts, that some programmers have suggested is a REST API and should be easily doable
I need a tool: Can convert any strategy of PineScript into .mql5 without bugs Automation convert for multiple strategy of PineScript files into multiple .mql5 files Programming can write in Python/C++ I have some PineScripts file to test (in attached files, with their names can find in TradingView -> Indicator -> search by name) I want to backtest all community strategy of TradingView, so that the tool need to be

Información sobre el proyecto

Presupuesto
15 - 20 USD
Para el ejecutor
13.5 - 18 USD
Plazo límite de ejecución
de 1 a 3 día(s)