July 9, 2019 at 3:23 pm #53987
- Topics: 10
- Replies: 18
- Posts: 28
This post is sort of related to this post but is slightly different.
It is about the calculation of values in incomplete periods.
For example, take closing price. What should the weekly timeframe closing price be showing on Monday, Tuesday, Wednesday or Thursday on a daily chart? Should it be static and show last week’s (last Friday’s) closing value on every day, or should it be dynamic and change with each day’s new closing price?
It seems that Optuma does it both ways. Some observations:
- A weekly chart does not wait until the end of the week before it gives the week’s closing price. The most recent bar will show the most recent closing price, even thought the week is incomplete from Monday-Thursday. In other words, the last bar on a weekly chart will show Monday’s closing price on Monday, Tuesday’s closing price on Tuesday, and so on. It keeps changing until the week is complete. The same occurs with other indicators too (e.g. Bollinger Bands, etc.)
- If a weekly closing price formula is plotted on a daily chart, it follows the daily closing price on Monday-Thursday, then settles to a final closing value on the Friday. See the attached screenshot where the thick green line (weekly closing price) is the same as the closing price on a Monday. This is the same behaviour as a weekly chart (see first observation).
- If the weekly closing price formula is shown as a cursor custom label, it remains at last week’s closing price from Monday to Thursday (see screen shot again, look for the label WeeklyClose at 2990.4 in the cursor labels). It is not dynamic in the same way as the weekly closing price is in observations 1 & 2.
- Using the weekly closing price formula in scripts gives the same outcome as observation 3. It is not dynamic in the same way as the weekly closing price is in observations 1 & 2.
It seems that Optuma handles timeframes in different ways depending on the context you are operating in. I would prefer that a consistent approach is applied in all contexts. I’m sure that most would prefer that too.
My view is that observations 1 & 2 above should be the standard way values are calculated in incomplete periods, in all contexts. That is, values are dynamic until the period is finished, at which time they become fixed in history.
Please reply with your own views or experiences on this matter. Perhaps I’m missing something and I’d really appreciate some good advice or insight. Otherwise, it would be great if the Optuma scripting community was able to gain some consensus and provide feedback to Optuma.
Many thanks, Dean
You must be logged in to access attached files.July 19, 2019 at 1:42 am #54079
- Topics: 2
- Replies: 8
- Posts: 10
Believe I've run into similar issues in Backtesting
Hey Dean, I believe I’ve run into similar issues as you when running a script with daily parameters with a “weekly” override. I have spoken with Optuma and it seems this is a known warning as I have been pointed to the following post which may also help you.
In my case, I only want to make trades on Friday’s close, but as you note, this can become an issue given the dynamicism of the weekly data.
Hope this helps.
You must be logged in to reply to this topic.