设为首页收藏本站

 找回密码
 注册
查看: 4246|回复: 1
打印 上一主题 下一主题

为什么我用系统自带的加仓减仓代码,在测试的时候用不了啊? [复制链接]

Rank: 4

精华
0
UID
112550
积分
263
帖子
89
主题
14
阅读权限
50
注册时间
2012-9-17
最后登录
2022-1-19
跳转到指定楼层
1#
发表于 2013-6-28 16:03:45 |显示全部楼层 |倒序浏览
代码如下:
Vars
Numeric MinPoint;//一个最小变动单位,也就是一跳
NumericSeries firstPrice;//第一次开仓价格
NumericSeries LastPrice;//最后一次开仓价格
Numeric AddSet(30);//加仓设置
Numeric SubSet(30);//减仓设置
Bool FirstEntryCon;//首次开仓条件lazer公式开发指南加仓减仓
-109-
Begin
FirstEntryCon=...
MinPoint=MinMove*PriceScale;
If(MarketPosition==0)
{
If(FirstEntryCon)
{
firstPrice=Open;
LastPrice=firstPrice;
Buy(2,firstPrice);
}
}else If(MarketPosition==1)//有多仓的情况
{
While(CurrentEntries<4&&High>=LastPrice+AddSet*MinPoint)//加仓
{
LastPrice=LastPrice+AddSet*MinPoint;
if(Open>LastPrice)LastPrice=Open;
Buy(1,LastPrice);
}
While(CurrentEntries>0&&Low<=firstPrice-SubSet*MinPoint)//减仓
{
firstPrice=firstPrice-SubSet*MinPoint;
if(Open<firstPrice)firstPrice=Open;
Sell(1,firstPrice);
}
}
...
End

Rank: 4

精华
0
UID
112550
积分
263
帖子
89
主题
14
阅读权限
50
注册时间
2012-9-17
最后登录
2022-1-19
2#
发表于 2013-6-28 16:04:58 |显示全部楼层
感觉这段代码有点问题,每次建仓后,只能建仓不能加仓。哪位达人能帮忙看一下啊?

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-5-24 00:38

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部