AnyDice, 8582 bytes
function:lN:nK:nL:nl N K L{ifL<0{result:[lowestNof(N-L)dK]}else{result:[highestNof(N+L)dK]}}
For the output, check the "export" view and "summary" data and take the first value next to the output name (normally the link brings you there, but if you encounter issues, you know).
Ungolfed for readability
function: l N:n K:n L:n { \ function with 3 parameters \
if L<0 { \ if L is negative \
result: [lowest N of (N-L)dK] \ return the lowest N dice among (N-L) rolls of a K-sided die \
} else { \ else \
result: [highest N of (N+L)dK] \ return the highest N dice among (N-L) rolls of a K-sided die \
} \ end if \
} \ end function \