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

MQL5 Scripts Integration

Job finished

Execution time 1 day
Feedback from customer
Great work, thanks.

Specification

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. 

Responded

1
Developer 1
Rating
(590)
Projects
789
71%
Arbitration
9
33% / 33%
Overdue
22
3%
Free
2
Developer 2
Rating
(119)
Projects
127
41%
Arbitration
3
33% / 67%
Overdue
0
Free
3
Developer 3
Rating
(97)
Projects
121
25%
Arbitration
5
20% / 60%
Overdue
17
14%
Free
4
Developer 4
Rating
(133)
Projects
185
30%
Arbitration
77
9% / 73%
Overdue
77
42%
Free
5
Developer 5
Rating
(39)
Projects
81
38%
Arbitration
1
0% / 0%
Overdue
31
38%
Free
Similar orders
Create script to move multiple take profits (from multiple trades) at one time. Typically for a single currency pair Summary: There are multiple trades in 1 currency pair There are multiple take profits, 1 for each trade I want a script to be built to modify all the take profits at one time There may be up to 20 take profits, from 20 different trades that I want to be able to move/adjust all at one time, very easily
Hi there - Overview We are seeking an experienced developer to create a Forex Robot Expert Advisor (EA) tailored to specific trading strategies and conditions. The EA will focus on the London trading session and will automate trades based on pre-defined calculations and market movements. *Responsibilities:* 1. *London Session Analysis:* - Develop functionality to highlight the London trading session on the forex
Dear Freelancers, I'm seeking a skilled MT4/MT5 developer to collaborate on a valuable trading indicator. Project Description: I'm looking to develop a powerful Elliott Wave indicator compatible with the MT4 and MT5 trading platforms. This indicator will be based on the highly successful [LuxAlgo] indicator currently available on TradingView. Key Features: In-indicator Alerts: The ability to receive pop-up
Profit EA 50+ USD
//+------------------------------------------------------------------+ //| SimpleEA.mq4 | //| Generated by MetaEditor | //| https://www.mql5.com/en/docs&nbsp ; | //+------------------------------------------------------------------+ #property strict // Input parameters input double LotSize = 0.1; // Lot size input int MovingAveragePeriod = 50; // MA
1. **Timeframe and Liquidity:** Focus on the 5-minute timeframe for liquidity analysis.(timeframe for liquidity should be editble) 2. **Candlestick MSS:** Monitor 1-minute candlestick patterns for entry signals.(should be editble) 3. **Swing Points:** Identify swing points using the high and low of the last three candles.(ict swimg high and low) 4. **Sell Setup:** - Wait for a 5-minute candle to take out the swing
i am looking for experienced programmer to create indicator for me. i am willing to pay for the service. and if it works amazingly like i expected. i will tip more money
High Low intraday ticker to display the most recent high low of up to 40 stock symbols. As a stock makes an intraday high low it will populate at the top and so on. Regardless of chart that's display it will continue to track high lows of the 40 stocks inputed. The 40 stocks can by manually changed. A high will display as green with the time (hour:minute:second), symbol, and last price. A low will be displayed as red
Modify an existing Python bot to trade bollinger bands, with iqoption api Currently the bot strategy is wrong, I am limited in my knowledge here and hope to fix this Hope to work with more experience people out there in relation to iqoption api and python
I need an EA to automate Tradingview alerts on MT4 using webhook alerts. The bridge/connector should be python based GUI. Required features at a minimum Mapping Tradingview alert formats to MT4 Automating market, limit and stop orders with entry price, stop loss, multiple TPs and trailing stop Lot sizing - fixed/% of balance/fixed amount breakeven, partial close and trailing stop Mapping pair name prefixes/suffixes
hi guys, I have a script, that I have been struggling to work. most of the work is done, just final touch of an expert is needed. The script Is using Fibonacci and Pivot standard in its base. look forward to hear from an expert! Best regards Sina

Project information

Budget
15 - 20 USD
For the developer
13.5 - 18 USD
Deadline
from 1 to 3 day(s)