var Bar: integer; for Bar := 1 to BarCount - 1 do begin { Entry Rules } if (priceclose (Bar) > priceopen (Bar)) then BuyAtMarket (Bar, ''); if (priceclose (Bar) < priceopen (Bar)) then shortAtMarket (Bar, ''); if (priceclose (Bar) > priceopen (Bar)) then sellatclose (bar, lastposition, ''); if (priceclose (Bar) < priceopen (Bar)) then coveratclose (bar, lastposition, ''); end;