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

MQL5 스크립트 통합

작업 종료됨

실행 시간 1 일
고객의 피드백
Great work, thanks.

명시

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. 

응답함

1
개발자 1
등급
(590)
프로젝트
789
71%
중재
9
33% / 33%
기한 초과
22
3%
무료
게재됨: 8 코드
2
개발자 2
등급
(119)
프로젝트
127
41%
중재
3
33% / 67%
기한 초과
0
무료
3
개발자 3
등급
(97)
프로젝트
121
25%
중재
5
20% / 60%
기한 초과
17
14%
무료
4
개발자 4
등급
(133)
프로젝트
185
30%
중재
77
9% / 73%
기한 초과
77
42%
무료
5
개발자 5
등급
(39)
프로젝트
81
38%
중재
1
0% / 0%
기한 초과
31
38%
무료

프로젝트 정보

예산
15 - 20 USD
기한
에서 1  3 일