paste this entire script into the formula editor
to = Row();
If( to - 5 < 0,
t from = 1,
from = to - 5
);
Quantile( 0.5, :Column[Index( From, To )] );
:Column and From need to be changed. So column is obviously the column you want to calculate the median, From is the number of rows you want to look backwards. so if I want the median between the current row and the previous 10, i'd type -10 for From. Hope that helps