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 codes
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 日