I assume you're after a reversal system, then the following will do the trick:
var Bar: integer;
var bp, sp: float;
for Bar := 20 to BarCount - 1 do
begin
if MarketPosition <= 0 then
begin
bp := Highest(Bar, #High, 30);
CoverAtStop(Bar+1, bp, LastPosition, 'SX')...