- 精华
- 0
- 在线时间
- 67 小时
- UID
- 94210
- 积分
- 71
- 帖子
- 10
- 阅读权限
- 30
- 注册时间
- 2012-1-27
- 最后登录
- 2016-12-13
- 精华
- 0
- UID
- 94210
- 积分
- 71
- 帖子
- 10
- 主题
- 1
- 阅读权限
- 30
- 注册时间
- 2012-1-27
- 最后登录
- 2016-12-13
|
你好,我采用多次开仓,每次开仓根据账户资金量和止损计算开仓量,可当触发止损时要对最后加仓部分平仓就不知道平仓量了。
lots1=Value(GetTBProfileString(Symbol,"lots1")); //从数据库取得开仓量
lots2=Value( GetTBProfileString(Symbol,"lots2"));
lots3=Value( GetTBProfileString(Symbol,"lots3"));
lots4=Value (GetTBProfileString(Symbol,"lots4"));
If(condition)
{
myentryprice1=,,,;//开仓价
zsx1=,,,;//止损价
r1=myentryprice1-zsx1; //止损额
TotalEquity=A_CurrentEquity();
lots1=(TotalEquity*RiskRatio/100)/(r1*ContractUnit()*BigPointValue());
lots1=IntPart(lots1); //开仓量
SetTBProfileString(Symbol,"lots1",Text(lots1));
},这样写好像不对,不知道该如何记录开仓量 |
|