wAvg = wAverage(c of data2,19);
mySlope = wAvg – wAvg[1];
If you interrogate mySlope intra-week then it will always be equal to zero. The wAvg is by default tied to data1 which in this case is daily bars. So the value of wAvg is carried over from one day to the next. It only changes when the average of the weekly bar changes and that only occurs on Friday.
There are two possible solutions:
Without the use of data aliasing – inLine function calls
mySlope = wAverage(c of data2,19) – wAverage(c[1] of data2,19) ;
With the use of data aliasing –
vars: wAvg(close of data2,0);
wAvg = wAverage(c of data2,19);
mySlop = wAvg – wAvg[1];
Either examples will work, but if you have several variables tied to a different data stream, then the code will be much cleaner looking using data aliasing – plus it cuts down on multiple function calls.