老师帮忙看看这段代码为什么会有信号闪烁

Params

//此处添加参数

Numeric Length(14) ; //周期

Numeric OverSold(30) ; //超卖开仓

Numeric OverBought(70) ; //超买开仓

Numeric OverSold1(28) ; //超卖平仓

Numeric OverBought1(74) ; //超买平仓

Numeric TakeProfitSet(30); //固定止盈点数

   Numeric StopLossSet(20);  //固定止损点数

   Numeric N(20); //移动止盈止损

   Numeric N2(10); //保本1

   Numeric N3(20); //保本2

   

   Numeric Lost(1); //每次开仓手数

Numeric W(10); //最多建仓手数


Vars

//此处添加变量

Series<Numeric> A;

Series<Numeric> B;

Series<Numeric> MAUP;

Series<Numeric> MAUP2;

Series<Numeric> MAUP3;

Series<Numeric> MAUP4;

Series<Bool> MAUP5;

Series<Bool> MAUP6;

Series<Bool> MAUP7;

Series<Bool> MAUP8;

Series<Numeric> NetChgAvg( 0 );

Series<Numeric> TotChgAvg( 0 );

Series<Numeric> SF( 0 );

Series<Numeric> Change( 0 );

Series<Numeric> ChgRatio( 0 ) ;

Series<Numeric> RSIValue;

Series<Numeric> MinPoint;

   Series<Numeric> MyEntryPrice;

   Series<Numeric> MyExitPrice;

   

   Series<Numeric> Highafterprice;

Series<Numeric> Lowafterprice;

Series<Numeric> E;

Series<Numeric> F;




Events

//此处实现事件函数


//Bar更新事件函数,参数indexs表示变化的数据源图层ID数组

OnBar(ArrayRef<Integer> indexs)

{

If(Time == 0.210000)

{

A = 0;

B = 0;

E = 0;

F = 0;

}

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

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

MinPoint = MinMove*PriceScale;

MyEntryPrice = AvgEntryPrice;

MAUP = HighD(1);

MAUP2 = CloseD(1);

MAUP3 = OpenD(1);

MAUP4 = LowD(1);

MAUP5 = CrossOver(RSIValue,OverBought);

MAUP6 = CrossUnder(RSIValue,OverSold);

MAUP7 = CrossOver(RSIValue,OverBought1);

MAUP8 = CrossUnder(RSIValue,OverSold1);

If(BarsSinceEntry == 0)

{

Highafterprice = Close;

Lowafterprice  = close;

If(MarketPosition <> 0)

{

Highafterprice = Max(Highafterprice,AvgEntryPrice);

Lowafterprice  = Min(Lowafterprice,AvgEntryPrice);

}

}

Else

{

Highafterprice = Max(Highafterprice,High);

Lowafterprice  = Min(Lowafterprice,Low);

}

If(CurrentBar <= Length - 1)

{

NetChgAvg = ( Close - Close[Length] ) / Length ;

TotChgAvg = Average( Abs( Close - Close[1] ), Length ) ;

}Else

{

SF = 1/Length;

Change = Close - Close[1] ;

NetChgAvg = NetChgAvg[1] + SF * ( Change - NetChgAvg[1] ) ;

TotChgAvg = TotChgAvg[1] + SF * ( Abs( Change ) - TotChgAvg[1] ) ;

}

If( TotChgAvg <> 0 )

{

ChgRatio = NetChgAvg / TotChgAvg;

}else

{

ChgRatio = 0 ;

}

RSIValue = 50 * ( ChgRatio + 1 );

PlotNumeric("RSI",RSIValue);

PlotNumeric("超买",OverBought);

PlotNumeric("超卖",OverSold);

If(MarketPosition == 0 && High >= MAUP && A == 0 && E < W)

{

Buy(Lost,Max(Open,MAUP));

A = 1;

B = 1;

E = E + 1;

}

If(MarketPosition == 0 && Low == MAUP && A == 1 && E < W)

{

Buy(Lost,MAUP);

E = E + 1;

}

If(MarketPosition == 0 && Low == MAUP2 && A == 1 && E < W)

{

Buy(Lost,MAUP2);

E = E + 1;

}

If(MarketPosition == 0 && Low == MAUP3 && A == 1 && E < W)

{

Buy(Lost,MAUP3);

E = E + 1;

}

If(MarketPosition == 0 && Low == MAUP4 && A == 1 && E < W)

{

Buy(Lost,MAUP4);

E = E + 1;

}

If(MarketPosition == 0 && MAUP6[1] && A == 1 && E < W)

{

Buy(Lost,Open);

E = E + 1;

}

If(MarketPosition == 0 && Low <= MAUP4 && B == 0 && F < W)

{

SellShort(Lost,Min(Open,MAUP4));

A = 2;

B = 2;

F = F + 1;

}

If(MarketPosition == 0 && High == MAUP4 && B == 2 && F < W)

{

SellShort(Lost,MAUP4);

F = F + 1;

}

If(MarketPosition == 0 && High == MAUP2 && B == 2 && F < W)

{

SellShort(1,MAUP2);

}

If(MarketPosition == 0 && High == MAUP3 && B == 2 && F < W)

{

SellShort(Lost,MAUP3);

F = F + 1;

}

If(MarketPosition == 0 && High == MAUP && B == 2 && F < W)

{

SellShort(Lost,MAUP);

F = F + 1;

}

If(MarketPosition == 0 && MAUP5[1] && B == 2 && F < W)

{

SellShort(Lost,Open);

F = F + 1;

}

If(MarketPosition == 1 && BarsSinceEntry >= 1)

{

If(High >= MyEntryPrice + TakeProfitSet*MinPoint)

{

MyExitPrice = MyEntryPrice + TakeProfitSet*MinPoint;

If(Open > MyExitPrice)

MyExitPrice = Open;

Sell(0,MyExitPrice);

}

Else If(Low <= MyEntryPrice - StopLossSet*MinPoint)

{

MyExitPrice = MyEntryPrice - StopLossSet*MinPoint;

If(Open < MyExitPrice)

MyExitPrice = Open;

Sell(0,MyExitPrice);

}

}

If(MarketPosition == -1 && BarsSinceEntry >= 1)

{

If(Low <= MyEntryPrice - TakeProfitSet*MinPoint)

{

MyExitPrice = MyEntryPrice - TakeProfitSet*MinPoint;

If(Open < MyExitPrice)

MyExitPrice = Open;

BuyToCover(0,MyExitPrice);

}

Else If(High >= MyEntryPrice + StopLossSet*MinPoint)

{

MyExitPrice = MyEntryPrice + StopLossSet*MinPoint;

If(Open > MyExitPrice)

MyExitPrice = Open;

BuyToCover(0,MyExitPrice);

}

}

If(MarketPosition == 1 && BarsSinceEntry > 0)

{

If(Low <= Highafterprice[1] - N*MinPoint)

{

MyExitPrice = Highafterprice[1] - N*MinPoint;

Sell(0,Min(Open,MyExitPrice));

}

}

If(MarketPosition == -1 && BarsSinceEntry > 0)

{

If(High >= Lowafterprice[1] + N*MinPoint)

{

MyExitPrice = Lowafterprice[1] + N*MinPoint;

BuyToCover(0,Max(Open,MyExitPrice));

}

}

If(MarketPosition == 1 && BarsSinceEntry > 0)

{

If(MAUP7[1])

{

Sell(0,Open);

}

}

If(MarketPosition == -1 && BarsSinceEntry > 0)

{

If(MAUP8[1])

{

BuyToCover(0,Open);

}

}

If(MarketPosition == 1 && BarsSinceEntry > 0)

{

If(Highafterprice[1] >= MyEntryPrice + N2*MinPoint)

{

If(Low <= MyEntryPrice + 1*MinPoint)

{

MyExitPrice = MyEntryPrice + 1*MinPoint;

Sell(0,Min(Open,MyExitPrice));

}

}

}

If(MarketPosition == 1 && BarsSinceEntry > 0)

{

If(Highafterprice[1] >= MyEntryPrice + N3*MinPoint)

{

If(Low <= MyEntryPrice + N3*MinPoint)

{

MyExitPrice = MyEntryPrice + N3*MinPoint;

Sell(0,Min(Open,MyExitPrice));

}

}

}

If(MarketPosition == 1 && Time >= 0.145500 && Time <= 0.150000)

{

Sell(0,Open);

}

If(MarketPosition == -1 && Time >= 0.145500 && Time <= 0.150000)

{

BuyToCover(0,Open);

}

}

老师,帮忙看看这段代码出现信号闪烁的原因是什么,谢谢

这段代码为什么会信号闪烁?
请老师帮忙看看代码的错误
信号闪烁会有什么后果
请老师看看这段代码是啥意思?谢谢了
这段代码哪里逻辑不对吗?哪位老师帮忙看看
请看下这段代码为什么会产生信号闪烁
帮忙看看代码
老师帮忙看下为什么信号一直闪烁
为什么平仓会有信号闪烁
老师,麻烦帮忙看看这个现象是信号闪烁导致的吗?

老师有空帮忙看看