MQL4のバージョンは持っていませんか?
bool UseMaximumPercentageatRisk = true; double MaximumPercentageatRisk =1;
bool IsMicroAccount = true ; //for accounts allowing 0.01 lots
double GetLots(double lotsize_bn) { int tmpdecimal=1; if(IsMicroAccount) { tmpdecimal=2; } double old_lot=lotsize_bn; if((NormalizeDouble(AccountFreeMargin()*(MaximumPercentageatRisk/100)/1000.0,tmpdecimal)<lotsize_bn) && UseMaximumPercentageatRisk) { lotsize_bn=NormalizeDouble(AccountFreeMargin()*(MaximumPercentageatRisk/100)/1000.0,tmpdecimal); if(lotsize_bn<MarketInfo(Symbol(),MODE_MINLOT)) { lotsize_bn=MarketInfo(Symbol(),MODE_MINLOT); Print("RPTrade-Lot adjusted from ",old_lot," to minimum size allowed by the server of ",lotsize_bn," but it DOES NOT comply with Maximum Risk condition. User interaction is required!"); } else { Print("RPTrade-Lot adjusted from ",old_lot," to ",lotsize_bn," to comply with Maximum Risk condition. Each trade can risk only ",MaximumPercentageatRisk,"% of free margin."); } } return (lotsize_bn); }
このようなものであるべきだ ;-)
R.
I was looking at your code in MQL5 for "Maximum Percentage of Equity Risk".
I have some doubts regarding to how to use it. I have the mqh file in the include file and use #include <RPTrade.mqh> at the expert that I want to use.
Can you elaborate more on how to use this code in a expert advisor please? I'm new to coding. I have made expert advisors, but I don't know how to call a class or function in another file.
私は右の関数GetLots(ロットサイズ)を呼び出す必要がありますか?そして、私の注文要求では、ロットのために "lotize "値を使用する必要がありますか?
ありがとうございました!
Patagonia2015さん、こんにちは、
まず、EAに2つの入力を追加する必要があります:
bool UseMaximumPercentageRisk=true; double MaximumPercentageRisk=25;
次に、関数GetLots()を呼び出し、括弧内にご希望のロットサイズを設定する必要があります:
double MyLotSize; MyLotSize = GetLots (100);
そして、あなたがMaximumPercentageRiskとして 入力したものとあなたのアカウントの株式に応じて、あなたは正しいサイズを取得します。
例えば、MaximumPercentageRisk = 1;で、自己資本が1000$の場合、この関数は0.01ロットを返します。
低リスクでトレードしてください。)
こんにちは。
私は初心者ですが、自分のロットサイズに一貫性を持たせる方法を持ちたいと思っています。
よろしくお願いします。
例えば、MaximumPercentageRisk = 1;とお客様の株式 = 1000$の 場合、関数は0.01ロットを返します。
低リスクでトレードしてください。)
要は、選択したリスクと現在の口座残高に基づいて適切なロットを取得することだと思っていました。
少しわかりやすくしていただけると助かります。ありがとうございます。
- 無料取引アプリ
- 8千を超えるシグナルをコピー
- 金融ニュースで金融マーケットを探索
株式リスクの最大パーセンテージ:
作者: Remi Passanello