Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
Can anyone give me a hand on how to create different moving averages in the script load?
I have some stock market data, daily values, and I want to create an average for the 5-10-20-50-100 and 200 days.
LOAD
'$(_vNameOfStock)' as Ticker,
'$(_vNameOfExchange)' as Exchange,
Day(Date) As StartDate,
Num(Month(Date)) As StartMonth,
Year(Date) As StartYear,
TradeDate,
Open,
High,
Low,
Close,
Volume,
[Adj Close]
FROM $(URL_String) (txt, codepage is 1252, embedded labels, delimiter is ',', msq);
Best regards
Espen
I think you might need to use Peek() or Previous() ?
Also read here: Peek() vs Previous() – When to Use Each
may be this?
Create a Bucket of your said days like, 0-5,5-10, 10-20 etc which cud be:
TradeDate-Date as Days
Then Expression like: avg(Close) if not wrong or your business logic for average calculation.