• MT5 账户信息相关函数


    账户信息相关函数

    AccountBalance() – 获取账户余额

    double AccountBalance()

    返回账户余额(账户中钱数) .

    示例:

    Print("账户余额 = ",AccountBalance());

    AccountCredit() – 获取账户信用额度

    double AccountCredit()

    返回账户信用额度.

    示例:

    Print("账户信用额度 = ", AccountCredit());

    AccountCompany() – 获取账户所在公司名称

    string AccountCompany()

    返回账户所在公司名称.

    示例:

    Print("账户所在公司名:", AccountCompany());

    AccountCurrency() – 获取账户结算货币名称

    string AccountCurrency()

    返回账户结算货币名称.

    示例:

    Print("账户结算货币:", AccountCurrency());

    AccountEquity() – 获取账户净值

    double AccountEquity()

    返回账户净值.

    示例:

    Print("账户净值 = ", AccountEquity());

    AccountFreeMargin() – 获取账户可用保证金

    double AccountFreeMargin()

    返回账户可用保证金.

    示例:

    Print("账户可用保证金 = ", AccountFreeMargin());

    AccountFreeMarginCheck() – 检查账户可用保证金

    double AccountFreeMarginCheck( string symbol, int cmd, double volume)

    当前账户以现价在指定的位置开仓后还剩余的保证金。如果保证金余额不足,将会生成错误134 (ERR_NOT_ENOUGH_MONEY)。

    参数:

    symbol - 交易的货币对。
    cmd - 交易类型,可能是 OP_BUY 或者 OP_SELL。
    volume - 交易手数。

    示例:

    if(AccountFreeMarginCheck(Symbol(),OP_BUY,Lots)<=0 || GetLastError()==134) 
      return;

    AccountFreeMarginMode() – 可用保证金计算方式

    double AccountFreeMarginMode()

    开仓时可用保证金计算方式。计算方式可能采取以下值:

    • 0一浮动盈利/亏损不参与计算
    • 1一浮动盈利和亏损在开仓部头寸上参与保证金余额计算;
    • 2一只有赢利参与计算,不考虑当前开仓头寸的亏损;
    • 3一只有亏损额参与计算,不考虑当前开仓头寸的亏损。

    示例:

    if(AccountFreeMarginMode()==0)
       Print("浮动盈利/亏损不使用。");

    AccountLeverage() – 获取账户杠杆比例

    int AccountLeverage()

    返回账户杠杆比例.

    示例:

    Print("账户杠杆比例:", AccountLeverage());

    AccountMargin() – 获取账户已用保证金

    double AccountMargin()

    返回账户已用保证金金额.

    示例:

    Print("账户已用保证金:", AccountMargin());

    AccountName() – 获取账户名

    string AccountName()

    返回账户的账户名.

    示例:

    Print("账户名:", AccountName());

    AccountNumber() – 获取账户号码

    int AccountNumber()

    返回账户的账户号码.

    示例:

    Print("账户号码:", AccountNumber());

    AccountProfit() – 获取账户盈利金额

    double AccountProfit()

    返回账户的盈利金额.

    示例:

    Print("账户盈利:", AccountProfit());

    AccountServer() – 获取账户连接的服务器名称

    string AccountServer()

    返回账户连接的服务器名称.

    示例:

    Print("服务器名称:", AccountServer());

    AccountStopoutLevel() – 获取账户的止损水平设置

    int AccountStopoutLevel()

    返回账户止损水平设置.

    示例:

    Print("账户止损水平设置 = ", AccountStopoutLevel());

    AccountStopoutMode() – 获取账户止损计算方式

    int AccountStopoutMode()

    返回账户止损水平的计算方式,计算方式可以采用下列的值:

    • 0一计算保证金和净值之间的百分比;
    • 1一比较剩余保证金标准和绝对值。

    示例:

    int level=AccountStopoutLevel();
    if(AccountStopoutMode()==0)
       Print("止损水平= ",level, "%");
    else
       Print("止损水平= ", level, " ", AccountCurrency());
  • 相关阅读:
    时区处理
    C#视频取帧图
    【C#】C#获取文件夹下的所有文件
    利用web of science做论文综述
    C# HTML解析工具HtmlAgilityPack使用实例(一)
    C#+HtmlAgilityPack+XPath带你采集数据(以采集天气数据为例子)
    win10文件夹或文件已在另一程序中打开
    指定网卡IP进行ping操作
    C# 使用WebClient时,在多网卡IP时,指定IP发送Web请求
    C# 消息队列
  • 原文地址:https://www.cnblogs.com/anlewang/p/10189771.html
Copyright © 2020-2023  润新知