|
Chaim6
2014-01-27 09:09:39
|
|
I am new to QS and was wondering how you go about lagging fundamental data so that it approximates when it was actually released?
I have tried the http://www.quantshare.com/item-1181-morningstar-historical-fundamentals downloader but it does not lag the dates are not lagged.
Am I missing something? Is there a way to artificially lag the dates by 45 days to 2 months when backtesting or should the adjustment take place by the downloader?
Thanks
(by Stefan Kroscen,
uploaded several months ago)
No notes
|
|
|
|
|
QuantShare
2014-01-27 13:09:29
0
|
|
The adjustment should take place in QS language.
If the fundamental data is stored in variable "a" then simply type:
a = ref(a, 45); // To lag it by 45 bars
|
|
|
|
Chaim6
2014-01-27 18:14:32
0
|
|
Sorry for my newbie question, but do you put "a = ref(a, 45);" into a download script or into the backtesting script?
Thanks
|
|
|
|
QuantShare
2014-01-27 21:53:20
0
|
|
Best Answer
In the backtesting script.
Example to get the close price lagged by 10 bars:
a = ref(close, 10);
|
|
|
|
Chaim6
2014-01-28 03:15:07
0
|
|
Thank you!
|
|
|
|
Seeker
2014-01-28 08:45:25
0
|
|
Is a=ref(close,10) and a= close[10] same? Are they always identical in usage? I have seen that in certain cases, the latter is not accepted.
|
|
|
|
QuantShare
2014-01-28 11:27:13
0
|
|
Yes it is the same. You can use [] only with variables (not with functions).
|
|
|
|
Seeker
2014-01-28 12:54:35
0
|
|
just to clarify further, for new high we say:
a = high>ref(hhv(high,10),1);
or:
a = hhv(high,20);
b = high>a[1];
but not:
a =high>hhv(high,20)[1];
Just trying to confirm whether I was following it correctly all this while...
|
|
|
|
QuantShare
2014-01-28 13:46:18
0
|
|
Yes, you can plot these variables on a chart to get a confirmation or to check whether something is correct or not.
New high can also be detected by:
a = high == hhv(high, 10);
|
|
|
|