Params
//此处添加参数
Series<Numeric>
Series<Numeric> var3;
Series<Numeric> var4;
Series<Bool> condition5;
Series<Bool> condition6;
Series<Numeric>Myprice;
Series<Numeric> var3op;
Series<Numeric> var4op;
Series<Numeric> LowerAfterEntry;
Series<Numeric> HigherAfterEntry;
Series<Numeric> Myprice2;
Series<Numeric> Myprice3;
Events
OnBar(ArrayRef<Integer> indexs)
{
//此处实现事件函数
var0=Average(C[1],N1);//短周期均线
var0=Average(C[1],N2);//中周期均线
condition1=CrossOver(var0,var2);//金叉
condition2=CrossUnder(var0,var2);//死叉
if(condition1)
{
bka=CurrentBar;
}
if(condition2)
{
bkx=CurrentBar;
}
var3=Highest(H[1],(bka-bkx)+1);//计算本次金叉至上次死叉的时间范围内的高点
condition3= condition1 and bka>bkx and bka>0 and bkx>0 and CurrentBar>0;
if(condition3)
{
var3op=var3;//条件3成立时,
}
condition4=condition2 and bkx>bka and bka>0 and bkx>0 and CurrentBar>0;
if(condition4)
{
var4op=var4;
}
condition5=var0>var2 and CrossOver(c[1],var3op);
if(condition5 and MarketPosition<>1)
{
Myprice=Open;
condition6=var0<var2 and CrossUnder(c[1],var4op);
if(condition6 and MarketPosition<>-1)
{
Myprice=Open;
SellShort(ss,Myprice);
HigherAfterEntry=EntryPrice;//保持空头开仓价格
}
//记录多头最低和空头最高价
if(MarketPosition==1 and BarsSinceEntry==0)
{
HigherAfterEntry= HigherAfterEntry[1];
LowerAfterEntry=Max(LowerAfterEntry,Lo
LowerAfterEntry=LowerAfterEntry[1];
}
LowerAfterEntry=Max(LowerAfterEntry,Low);
}
//跟踪出场
Myprice2 = LowerAfterEntry - open*TR/100;//
//PlotNumeric("myprlce2", Myprice2);//多头显示线
if(MarketPosition==1 and Low<=Myprice2 and BarsSinceEntry>0)
{
myprice2=min (myprice2,Open);
Sell(ss,myprice2);
Commentary("多头出场");
}
Myprice3=HigherAfterEntry+open*TR/100;
if(MarketPosition==-1 and High> Myprice3 and BarsSinceEntry>0)
{
Myprice3=max(Myprice3,Open);
}
// PlotNumeric("myprlce3", Myprice3);//空头显示线
}
//------------------------------------------------------------------------
这个是tbq的语法,没什么问题
不显示是什么意思
不显示买卖点
谢谢
这是我转换完的,在TBq上不显示