you don't need a parameter in this case, if you did you would just create it in the subreport and link to in the main (like you did with the id, right click on the subreport inthe main report and select change links).
Here all you need it the top and bottom 5, a couple of formulas should be all you need.
a formula that counts row, simply
shared numbervar linecount := linecount +1
a formula that can count the number of records in the set:
shared numbervar numRec := count({table.field})
and a formula in the suppression of the detail line:
linecount > 5 and linecount < numRec - 5
that should do, the line count formula goes on the detail line, the record count goes in a group header in the subreport and the suppression on the detail section.
Should be a good start.
HTH