- 精华
- 0
- 在线时间
- 194 小时
- UID
- 251844
- 积分
- 115
- 帖子
- 39
- 阅读权限
- 30
- 注册时间
- 2017-5-31
- 最后登录
- 2018-2-7
- 精华
- 0
- UID
- 251844
- 积分
- 115
- 帖子
- 39
- 主题
- 19
- 阅读权限
- 30
- 注册时间
- 2017-5-31
- 最后登录
- 2018-2-7
|
发表于 2017-7-18 16:02:11
|显示全部楼层
本帖最后由 marialeng 于 2017-7-18 16:06 编辑
我写了一个策略,可是加仓不对。代码是:
//空仓进场
If (marketposition==0 And Condition2)
{
FirstEntryPrice = Min(Low[1],Low[2]);
unAddSetPrice = Min(open,FirstEntryPrice);
{
SellShort(lots,unAddSetPrice);
}
}
//空仓加仓
If (marketposition==-1 And BarsSinceEntry >= 1 And CurrentEntries > 0 And CurrentEntries < 2 And Condition2 And Low <= unAddSetPrice - pre_atr)
{
AddSetPrice = Min(open,(unAddSetPrice - pre_atr));
SellShort(lots,AddSetPrice);
}
If (CurrentEntries >= 2 And Condition2 And Low <= AddSetPrice[1] - pre_atr)
{
AddSetPrice = Min(open,(AddSetPrice[1] - pre_atr));
SellShort(lots,AddSetPrice);
}
不知道为什么第二根bar加仓后,又以第二根bar的开盘价加了一次。那位老师帮我看看,是哪里出了问题。 |
附件: 你需要登录才可以下载或查看附件。没有帐号?注册
|