每天开盘后十五分钟,价格突破日内最高(前15分钟最高或者最低)做多反之做空,如果反向突破平仓或者下午收盘前3分钟平仓,之后不再开仓每天只做一次。各位老师这样的日内代码怎么写?
策略:开盘后15分钟,当价格突破当日最高做多,如果反向突破平仓或者到14点57分钟自动平仓。我按照视频写了这个策略,但运行不了,不知道问题出在哪里了,老师能帮我改正一下吗?
Params
//此处添加参数
Numeric millsecs(1000);
Vars
//此处添加变量
Series<Numeric> barCount_in_day;
Series<Numeric> high1;
Series<Numeric> low1;
Events
OnBar(ArrayRef<Integer> indexs)
{
if(TrueDate(0)<>TrueDate(1))//time==21:15
{
high1=open;
low1=open;
barCount_in_day=0;
}
barCount_in_day=BarCount_in_day+1;
if(BarCount_in_day<=15)
{
high1=max(high,high1);
low1=min(low,low1);
}
if(MarketPosition=0 and high>=high1);
{
Buy(max(open,high1)
}
if(MarketPosition==1 and low<=low1);
{
sell(min(open,low1))
}
// 到时间出场
Else If(time <= 14:57)
{
sell(Open);
}
}
我不会pyhon啊。有没有一个日内模型参考啊?
Params
//此处添加参数
Numeric millsecs(1000);
Vars
//此处添加变量
Series<Numeric> barCount_in_day;
Series<Numeric> high1;
Series<Numeric> low1;
Events
OnBar(ArrayRef<Integer> indexs)
{
if(TrueDate(0)<>TrueDate(1) or BarStatus==0)//time==21:15
{
high1=open;
low1=open;
barCount_in_day=0;
}
barCount_in_day=BarCount_in_day+1;
if(BarCount_in_day<=15)
{
high1=max(high,high1);
low1=min(low,low1);
}
if(MarketPosition == 0 and high>=high1)
{
Buy(max(open,high1));
}
if(MarketPosition==1 and low<=low1)
{
sell(min(open,low1));
}
// 到时间出场
Else If(time <= 0.1457)
{
sell(0,Open);
}
}
策略:开盘后15分钟,当价格突破当日最高做多,如果反向突破平仓或者到14点57分钟自动平仓。我按照视频写了这个策略,但运行不了,不知道问题出在哪里了,老师能帮我改正一下吗?
我这个哪里出了问题达不到,我要的效果?