KCM:EA编程教程大全之账户函数

2025-07-23

AccountBalance

AccountCredit

AccountCompany

AccountCurrency

AccountEquity

AccountFreeMargin

AccountFreeMarginCheck

AccountFreeMarginMode

AccountLeverage

AccountMargin

AccountName

AccountNumber

AccountProfit

AccountServer

AccountStopoutLevel

AccountStopoutMode

double AccountBalance( )

返回账户余额(账户中相当数量的价格值金钱).

示例:

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

double AccountCredit( )

返回账户信用点数.

示例:

Print("账户点数 ", AccountCredit());

string AccountCompany( )

返回账户公司名。

示例:

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

string AccountCurrency( )

返回账户所用的通货名称。

示例:

Print("账户货币对", AccountCurrency());

double AccountEquity( )

对于当前账户返回资产净值。资产净值取决于交易服务器的设置。

示例:

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

double AccountFreeMargin( )

返回当前帐户的免费保证金价格值。

示例:

Print("账户免费保证金 = ",AccountFreeMargin());

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 || KCMGetLastError()==134) return;

double AccountFreeMarginMode( )

在当前开仓位置的账户上计算免费保证金的模式。计算方式可能采取以下价格值:

0 - 浮动profit/loss 不使用

1 - 两个浮动赢利和损失在开仓位置上使用计算自由保证金;

2 - 只有赢利值被使用计算,不考虑当前开仓的亏损;

3 - 只有亏损值被使用计算, 不考虑当前开仓的亏损。

示例:

if(AccountFreeMarginMode()==0)

Print("浮点盈利/亏损不使用。");

int AccountLeverage( )

返回当前账户杠杆比率。

示例:

Print("账户#",AccountNumber(), " 杠杆比率", AccountLeverage());

double AccountMargin( )

返回当前帐户的保证金。

示例:

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

string AccountName( )

返回当前帐户名称。

示例:

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

int AccountNumber( )

返回当前帐户的数字。

示例:

Print("账户数字", AccountNumber());

double AccountProfit( )

返回账户利润。

示例:

Print("账户利润", AccountProfit());

string AccountServer( )

返回连接服务器的名称。

示例:

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

int AccountStopoutLevel( )

返回停止水平值。

示例:

Print("停止水平 = ", AccountStopoutLevel());

int AccountStopoutMode( )

对于停止水平返回的的运算方式。运算方式值如下:

0 - 计算保证金和净值之间的百分比;

1 - 比较自由保证金水平和绝对值。

示例:

int level=AccountStopoutLevel();

if(AccountStopoutMode()==0)

Print("停止水平= ",水平, "%");

else

Print("停止水平= ", 水平, " ", AccountCurrency());

版权声明

本文仅代表作者观点,不代表本站立场。
本文系作者授权本站发表,未经许可,不得转载。

下一篇 : 没有了