Well, like the error message says: You should not define a series outside of run(). The idea of a series is that it is shifted automatically with every run() -- but that is not what you want here. So you want to declare your series with a negative length and manually shift your series with every tick().

This works:
Code
#include <profile.c>
vars Data10;
//------------------------ 
void tick() {
    var s = Spread;
    shift(Data10, s, 30);
    var aAvg = Median(Data10, 30);
    print(TO_INFO,"Avg=%f", aAvg);
}

// --------------------------- Main-----------------------------
function run() {
    Data10 = series(0, -30);
    LookBack = 0;
    print(TO_WINDOW,"\nSpread=%f", Spread);
}