Why can not backtest be used on the following code?

Hello
I am very beginner and I do not understand much yet. Asking for a suggestion why backtest does not show transactions since the online graph shows periodically the signals that disappear after the next bars.
I will be grateful for your help.

Witam
Jestem mocno początkujęcy i nie wiele jeszcze rozumiem. Prośba o sugestie, dlaczego backtest nie pokazuje transakcji skoro na wykresie online okresowo pokazują się sygnały, które po kolejnych barach znikają.
Będę wdzięczny za pomoc.

// requirements
Version( 6.27 );

function SupResLevels( bars, colorUp, ColorDn, byRef1, byRef2 )
{
bi = BarIndex();
lvbi = LastValue( bi );

// return HHV value only for bars starting from the bar where HHV level was established
hv = IIf( bi >= lvbi - LastValue( HHVBars( High, bars ) ), LastValue( HHV( High, bars ) ), Null );

// the same approach for LLV
lv = IIf( bi >= lvbi - LastValue( LLVBars( Low, bars ) ), LastValue( LLV( Low, bars ) ), Null );

// plot levels
Plot( hv, "hv", colorUp, styleDashed | styleThick);
Plot( lv, "lv", ColorDn, styleDashed | styleThick );

// Assing calculated local arrays to param passed by ref
byRef1 = hv;
byRef2 = lv;

}

// price plot
Plot( Close, "By Ref: USING Local Vars - Close", colorDefault, styleBar );

// call function with various parameters
SupResLevels( 40, colorBrightGreen, colorRed, &hv1, &lv1 );
SupResLevels( 100, colorBrightGreen, colorRed, &hv2, &lv2 );

///////////////////////////////////////
a = lv1 == lv2;
d = hv1 == hv2;

Buy = a;
Sell = d;

/////////////////////////////////////

// Exploration
Filter = 1;
AddColumn( C, "Close" );
AddColumn( hv1, "HV1" );
AddColumn( lv1, "LV1" );
AddColumn( hv2, "HV2" );
AddColumn( lv2, "LV2" );
SetSortColumns(1); // sort by ticker