- 精华
- 0
- 在线时间
- 63 小时
- UID
- 275910
- 积分
- 54
- 帖子
- 34
- 阅读权限
- 30
- 注册时间
- 2019-2-22
- 最后登录
- 2020-4-7
- 精华
- 0
- UID
- 275910
- 积分
- 54
- 帖子
- 34
- 主题
- 16
- 阅读权限
- 30
- 注册时间
- 2019-2-22
- 最后登录
- 2020-4-7
|
本帖最后由 visions111 于 2019-4-29 13:24 编辑
Params
Vars
bool time1;
bool time2;
bool time3;
Numeric stopPrice;
Numeric sun(10);
Begin
time1 = time>=0.1015 &&time<0.1030;
time2 = time>=0.1400 && time<0.1450;
time3 = time>0.0900 && time<0.1500;
stopPrice=EntryPrice-sun*MinMove*PriceScale;//止损在sun跳
If(time3){
If(time==0.0905)//每天9:05开多开空各一手
{
Buy(1,0);
SellShort(1,0);
}
if(!time1 && !time2 && marketposition==1)
{
if(low<=stopPrice)
{Sell(0,Min(Open,stopPrice));}//多头止损
Else if(low>stopPrice&&time==0.1450)
{Sell(0,0);}//没止损的仓位持有到收盘14:50时候平仓
}
if(!time1 && !time2 && marketposition==-1)
{
if(low<=stopPrice)
{BuyToCover(0,Min(Open,stopPrice));}//空头止损
Else if(low>stopPrice&&time==0.1450)
{BuyToCover(0,0);}//没止损的仓位持有到收盘14:50时候平仓
}
if(!time1 && !time2 && marketposition==0 && BarsSinceExit==2)
{Buy(0,0);}//止损后下两个bar后再开仓
}
End
想要实现的效果是
每天09:05 开多开空各一手,但是在K线图上9:05却显示了三个操作:buy,sell,sellshort。
每天14:50多头和空头平仓的指令也没有实现,
止损后下两个bar设定再开仓
|
|