Stock my crossing signal in a bool, and reuse it in same candle

 

Hi everyone ! 

 

I use a custom indcator, which in a 2 important level 0 & 20. I would like to when a news candle appears if she crossed 1 my bool set true, but if she crossed 15 IN THE SAME CANDLE  ! She set an another bool true. 

I try this :

bool StopTrading=false;
bool SignalBuy=false; 
bool SignalSell=false; 
 static datetime NewsBar;
  if (NewsBar!= Time[0]){
      if((PrT>1)&&(PrT<1.5))SignalBuy=true;else SignalBuy=false;
      if((SignalBuy==true)&&(PrT>CriticalGap))Stoptrading=true;
      if((PrT<1)&&(PrT>1.5))SignalSell=true;else SignalSell=false;
      if((SignalSell==true)&&(PrT<CriticalGap))StopTrading=true;
      NewsBar = Time[0];}

( CriticalGap = 15 ) 
 But it's not work very well ... 

Reason: