【MQL4勉強プログラミング】取引口座の強制ロスカット値を取得する方法

AccountStopoutLevel()関数は、取引口座の強制ロスカット値を取得するために使用します。

AccountStopoutLevel()関数は、以下のように定義されています。

int AccountStopoutLevel();

AccountStopoutLevel()関数には引数がないので、()内には何も記述しません。

戻り値

取引口座の強制ロスカット値が「%」単位、又は「金額」単位で返されます。

いずれの単位で返されるかは、AccountStopoutMode()関数を使用することによって識別することができます。

具体例

取引口座の強制ロスカット値を「ターミナルウィンドウ」に表示させたい場合は、以下のように記述します。


#property strict

#property show_confirm

void OnStart()
{
  int Level = AccountStopoutLevel();
  
  if(AccountStopoutMode() == 0)
    {
      Print("Stop-Out Level = ",Level," %");
    }
  else if(AccountStopoutMode() == 1)
         {
           Print("Stop-Out Level = ",Level," ",AccountCurrency());
         }
}