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

MQL5 Scripts Intégration

Tâche terminée

Temps d'exécution 1 jour
Commentaires du client
Great work, thanks.

Spécifications

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. 

Répondu

1
Développeur 1
Évaluation
(590)
Projets
789
71%
Arbitrage
9
33% / 33%
En retard
22
3%
Gratuit
2
Développeur 2
Évaluation
(119)
Projets
127
41%
Arbitrage
3
33% / 67%
En retard
0
Gratuit
3
Développeur 3
Évaluation
(97)
Projets
121
25%
Arbitrage
5
20% / 60%
En retard
17
14%
Gratuit
4
Développeur 4
Évaluation
(133)
Projets
185
30%
Arbitrage
77
9% / 73%
En retard
77
42%
Gratuit
5
Développeur 5
Évaluation
(39)
Projets
81
38%
Arbitrage
1
0% / 0%
En retard
31
38%
Gratuit
Commandes similaires
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

Informations sur le projet

Budget
15 - 20 USD
Pour le développeur
13.5 - 18 USD
Délais
de 1 à 3 jour(s)