- 精华
- 0
- 在线时间
- 118 小时
- UID
- 212247
- 积分
- 128
- 帖子
- 83
- 阅读权限
- 40
- 注册时间
- 2015-6-28
- 最后登录
- 2019-11-15
- 精华
- 0
- UID
- 212247
- 积分
- 128
- 帖子
- 83
- 主题
- 23
- 阅读权限
- 40
- 注册时间
- 2015-6-28
- 最后登录
- 2019-11-15
|
zzscome 发表于 2017-2-11 19:30
请教一下:N=账户资金*5%/【(20日最高点-10日最低点)*每手吨数】
开仓条件:突破20日最高点(20日最低点 ...
Params
Vars
Numeric Enter;
NumericSeries TotalCapital;
Bool Entrycon;
Bool Entrycon2;
numeric EntryLots;
Begin
If(barstatus==0)
{SetGlobalVar(0,0);}
else Enter=GetGlobalVar(0);
TotalCapital=Portfolio_CurrentCapital+Portfolio_CurrentEquity;
EntryCon=(Enter==0 and High>Highest(high[1],20));
EntryCon2=(TotalCapital*0.05>Portfolio_CurrentCapital);
EntryLots=IntPart(TotalCapital*0.05/(Open*ContractUnit()*BigPointValue*Marginratio()));//以当前开盘价计算交易手数 取整
If(EntryCon==true and EntryCon2==true)
{
Buy(EntryLots,Max(open,Highest(High[1],20)+minmove*pricescale));
SetGlobalVar(0,1);
}
If(barssinceentry>1 and Low<lowest(low[1],10) and getglobalvar(0)==1 )
{
Sell(0,min(open,Lowest(low[1],10)-minmove*pricescale));
SetGlobalVar(0,0);
}
End
看能不能满足你的 想法. |
|