Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I want to calculate Simple Moving Average for Stock for last 90 Days. I cannout use the Average function bcz for Weeends I dont have data and also on Bank Holidays I dont hvae data. For Ex. On EveryMonday I will have previous value as of Friday rather than Saturaday/Sunday, or you can compare it with the Stock Exchange.
Using Average I am getting Incorrect Values bcz as on Monday this week I want to pick data for all working 90 days, and if I change my date selections from Monday to Last week Friday, so Moving Average should be calculated from Friday -90 Working Days from there.
I have tried using the Running Totals, but its not working, Below is what I am doing:
A:
Load DISTINCT Dates RESIDENT A; // To get the Distince dates bcz I might have multiple transaction on a given dates.
B:
Load RowNo(), Dates RESIDENT A; ORDER BY Dates DESC;// This will give me the no's on dates in Descending order.
Now while displaiyng data how I want to calculate Moving Average. Let me know how to write it in a Script or in a CHART Expression so that I can have correct out put.
Regards,
Amit
In chart you can try using Full Accumulation.
Regards
Amar
I already checked this but its not working... Any other help?
Do you have some data ?That could help us to help you.
Thanks
Philippe
Assuming your Date field only has values for when the stock exchange is open, and your X-axis is the Date, I would assume you could Accumulate 90 Steps Back and use avg(Price)/90.