为什么timepoint会导致信号闪烁?

严格看了视频说的,还是又闪烁



代码如下



Params

Numeric BH(150);

Numeric dh(40);

Numeric lot(0);

Numeric FastLen(60); // 分钟线

Numeric SlowLen(30); //分钟

Numeric NomLen(20); //日线

Numeric NomL(10);  //10日高低点

Numeric Ch(5); //前多少根日线

Numeric  Length(100); //多少根分钟线


Numeric signbuy(0);

Numeric signsell(0);

Numeric ReBar(200);






Vars

series<Numeric> MinPoint(0);           // 声明变量MinPoint,一个最小变动单位,也就是一跳。

Numeric MyEntryPrice(0);            // 声明变量MyEntryPrice,英文好的,看英文意思都知道的,开仓价格,本例是开仓均价,也可根据需要设置为某次入场的价格。

Series<Numeric> FastMA; // 快速均线

Series<Numeric> SlowMA; // 慢速均线

Numeric NomMA;

Series<Numeric> x(0);

Series<Numeric>  sig(1);

Series<Numeric> tt;

Series<Numeric> ReEntryCount; // 跟踪止损后记录BAR序号

   Numeric MyExitPrice;             // 声明变量MyExitPrice,平仓价格。

Series<Numeric>  ATR;

Series<Numeric>  StopPri; //跟踪止损价

Series<Numeric>  StopLPri;

Series<Numeric> stopwin;

Series<Numeric>  HighValue; //多头进场之后的盈利峰值价

Series<Numeric>  AF;

Series<Numeric>  xx(0);

Series<Numeric>  xy(0); //跟踪Acceleration

Series<Numeric> HighestAfterEntry;           //声明序列变量HighestAfterEntry,开仓后出现的最高价。

Series<Numeric> LowestAfterEntry;             //声明序列变量LowestAfterEntry,开仓后出现的最低价。

Numeric StopPrice(0);

Series<Bool>  Condition1(False);

series<Bool> Yun(False);

series<bool> condition(true);


series<bool> condition2(true);


Numeric StopATR;

Series<Numeric>  HH;

Numeric HHH; // 最近N根BAR的高点

Series<Numeric>  LL;

Numeric PP;

Global Numeric h1;

Global Numeric l1; // 最近N根BAR的低

Numeric DDH;

Numeric Bigbar;

Numeric CL;


Series<Numeric> PPP;    

Series<Numeric> LD;

Series<Numeric> H1d;

Series<Numeric> H2d;

Series<Numeric> L1d;

Series<Numeric> L2d;

Series<Numeric> op;

Series<Numeric> HD;  

Series<Numeric> lld;

Series<Numeric> hhd;


Series<Bool> shang; //锤子线阳

Series<Bool> xia;// 吊头线阴



Numeric MyRange; //K线幅度


Events


OnInit()

{   Array<Numeric> timepoint;

   timepoint[0] = 0.145950;

    timepoint[1] = 0.022950;

SetTriggerBarClose(timepoint);

}


OnBar(ArrayRef<Integer> indexs)

{  

if(time==0.0900 or time ==0.2100)

{ h1=high;

 l1=low;

 

}


range[0:0]

{

HD=Highest(high[1],dh);

LD=Lowest(Low[1],dh);

H2d=Highest(high[1],BH);

L2D=Lowest(Low[1],BH);

MinPoint = MinMove*PriceScale;//固定的最小跳动价公式。

HH=max(open,AvgEntryPrice-2*minpoint);

ll=min(open,AvgEntryPrice+2*minpoint);

Commentary("data1.h1d="+Text(data1.h1d));

Commentary("XY="+Text(XY));

Commentary("Highest(high[1],40)="+Text(Highest(high[1],40)));

Commentary("1.03*Lowest(low[1],40)="+Text(1.03*Lowest(low[1],40)));

Commentary("x="+Text(x));

FastMA = Average(Close, FastLen);

SlowMA = Average(Close,SlowLen);

PlotNumeric("FastMA",FastMA);

PlotNumeric("SlowMA",SlowMA);

if( truedate(0)<>truedate(1))

{

xx=0;

x=0;

xy=0;

}



}





if(MarketPosition ==0 )


{


If(high >FastMA and high>h1 and  ( xx==0 or BarsSinceExit>60) )     //开多单

{

{ Buy(0,max(open,HD+MinMove*PriceScale));

     lld=low[1];

     condition = false;

}


 

}

   

 

If(low <FastMA and low<l1 and (xy==0 or BarsSinceExit>60)   )   //开空单

{SellShort(0,min(open,LD-MinMove*PriceScale));

       hhd=high[1];

         condition = false;

}


   //

 

 

}

}

   OnBarClose(ArrayRef<Integer> indexs)

{    



   If(BarsSinceEntry>30 And MarketPosition==1 AND VOL >0  and Low <FastMA   ) // 有多仓的情况下。

   {

    Sell(0,Close);

    xx=1;

   

   

  }

   

  If( VOL >0 And ((time>=0.1459 and time<0.1500) or( time >=0.0229 and time <0.0230) ) ) // 有多仓的情况下。

   {   if(MarketPosition==1)

    {Sell(0,Close);}

   

   xx=0;

   XY=0;

   }

 

If(BarsSinceEntry>30 And MarketPosition==-1 AND VOL >0  and Close >FastMA )  // 有空仓的情况下。

{

BuyToCover(0,Close);

xy=1;

}

 If( VOL >0 And ((time>=0.1459 and time<0.1500) or( time >=0.0229 and time <0.0230) ) ) //// 有空仓的情况下。

{ if(MarketPosition==-1)

{BuyToCover(0,Close);}

xy=0;

XX=0;}

}

这段代码为什么会信号闪烁?
不会导致开平仓的信号闪烁会影响回测的净值走势吗?
请问同一根K线上开仓平仓是否会导致信号闪烁
多图层导致的信号闪烁
为什么会闪烁
关于手数不同为什么会导致价格计算不同
解决多周期信号闪烁导致小周期不计算
使用ma均线导致的信号闪烁如何处理
请看下这段代码为什么会产生信号闪烁
为什么说用了样本量设置会导致策略单元显示的仓位和K线信号不一致?那哪个是准的?

严格看了视频说的?

视频里不是说了如果用了SetTriggerBarClose(timepoint),那就可能会信号闪烁啊?

可是还有别的办法处理吗?比如我想再14:59:40平仓,是否只能用A函数?

比如写再onbar{}里,会不会好