You don't need any barssince to delay entry.
Simply use Ref() for entry delay.
P1 = ParamField("Price field",-1);
Periods1 = Param("Periods1", 5, 2, 300, 1, 10 );
P2 = ParamField("Price field",-1);
Periods2 = Param("Periods2", 21, 2, 300, 1, 10 );
P3 = ParamField("Price field",-1);
Periods3 = Param("Periods3", 55, 2, 300, 1, 10 );
BuyPrice = Open;
buytriggered = EMA(P1, Periods1) > EMA(P2, Periods2) AND EMA(P1, Periods1) > EMA(P3, Periods3);
Buy = Ref(buytriggered, -1) AND H > Ref(High,-1);// No BarSince required!
Buy = Ref(Buy, -1);// Adding bar delay if entering next day/bar at Open!
Besides if using code in analysis backtester there is SetTradeDelays() function:
P1 = ParamField("Price field",-1);
Periods1 = Param("Periods1", 5, 2, 300, 1, 10 );
P2 = ParamField("Price field",-1);
Periods2 = Param("Periods2", 21, 2, 300, 1, 10 );
P3 = ParamField("Price field",-1);
Periods3 = Param("Periods3", 55, 2, 300, 1, 10 );
SetTradeDelays(1, 1, 1, 1);// Adding bar delay if entering next day/bar at Open!
BuyPrice = Open;
buytriggered = EMA(P1, Periods1) > EMA(P2, Periods2) AND EMA(P1, Periods1) > EMA(P3, Periods3);
Buy = Ref(buytriggered, -1) AND H > Ref(High,-1);// No BarSince required!
And some code using some Sell rule in addition and if not using Cross() function
P1 = ParamField("Price field",-1);
Periods1 = Param("Periods1", 5, 2, 300, 1, 10 );
P2 = ParamField("Price field",-1);
Periods2 = Param("Periods2", 21, 2, 300, 1, 10 );
P3 = ParamField("Price field",-1);
Periods3 = Param("Periods3", 55, 2, 300, 1, 10 );
BuyPrice = SellPrice = Open;
buytriggered = EMA(P1, Periods1) > EMA(P2, Periods2) AND EMA(P1, Periods1) > EMA(P3, Periods3);
Buy = Ref(buytriggered, -1) AND H > Ref(High,-1);// No BarSince required!
Buy = Ref(Buy, -1);// Adding bar delay if entering next day/bar at Open!
Sell = EMA(P1, Periods1) < EMA(P2, Periods2);
Sell = Ref(Sell, -1);// Adding bar delay if exiting next day/bar at Open!
// remove excessive signals
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
Plot( C, "Price", colorDefault, styleCandle );
PlotShapes( Buy * shapeUpArrow, colorGreen, layer = 0, y = L, dist=-12 );
PlotShapes( Sell * shapeDownArrow, colorRed, layer = 0, y = H, dist=-12 );