- 精华
- 0
- 在线时间
- 30 小时
- UID
- 277671
- 积分
- 13
- 帖子
- 7
- 阅读权限
- 10
- 注册时间
- 2019-4-10
- 最后登录
- 2021-2-2
- 精华
- 0
- UID
- 277671
- 积分
- 13
- 帖子
- 7
- 主题
- 4
- 阅读权限
- 10
- 注册时间
- 2019-4-10
- 最后登录
- 2021-2-2
|
小米 发表于 2019-10-30 08:53
有持仓信号时读取,不可能为0的。
为0的结果是不是放在开仓前读取了?
麻烦老大帮我看看,用前两日的高低点突破开,止损用的开仓价格加减几跳。
Params
Numeric Fund(50000);
Vars
NumericSeries Highd1;
NumericSeries Highd2;
NumericSeries Lowd1;
NumericSeries Lowd2;
Numeric MinPoint; //最小变动价
Numeric Lots(1);
numeric CS(0);
Numeric MyEntryPrice;//开仓价格
NumericSeries Var1( 0 );
BoolSeries BS;
BoolSeries SS;
BoolSeries bk(False);
BoolSeries bp(False);
BoolSeries sk(False);
BoolSeries sp(False);
//如果当天第一笔交易是止损则当天不再开仓,还不会写
Begin
If(!CallAuctionFilter()) Return;
Var1=Max(1,IntPart(Fund/(O*ContractUnit*BigPointValue*0.1)));
highd1 = HighD(1);
highd2 = HighD(2);
lowd1 = LowD(1);
lowd2 = LowD(2);
MyEntryPrice = AvgEntryPrice;//开仓价格
MinPoint = MinMove*PriceScale;//最小变动价
BK = HighD1 < highd2 && High > highd2 ;
BP = Low <lowd1;
SK = lowD1 > lowd2 && Low< LOWD2;
SP = High>HIGHD1;
BS = C < MyEntryPrice-MinPoint*8;
SS = C > MyEntryPrice+minpoint*8;
Commentary("开仓价格:"+Text(MyEntryPrice));
Commentary("多损价格:"+Text(MyEntryPrice-MinPoint*8));
Commentary("空损价格:"+Text(MyEntryPrice+MinPoint*8));
If ( MarketPosition != 1 && CS < 2 && BK)
{
Buy(Lots,High);
Commentary("bk");
cs = cs+1;
}
If (MarketPosition == 1 && BP)
{
Sell(Lots,low);
Commentary("BP");
}
If (MarketPosition != -1 && CS <2 && sk)
{
SellShort(Lots,low);
Commentary("SK");
cs = cs+1;
}
If (MarketPosition == -1 && sp)
{
BuyToCover(Lots,high);
Commentary("SP");
}
If (MarketPosition ==1 && BS)
{
Sell(Lots,low);
Commentary("Bs");
}
If (MarketPosition == -1 && ss)
{
BuyToCover(Lots,high);
Commentary("SS");
}
End
|
|