Can timeframe override be applied to imported scripts?

Optuma Forums Optuma Scripting How do I apply a Weekly Time Frame override Can timeframe override be applied to imported scripts?

#53921
Dean
  • Topics: 13
  • Replies: 25
  • Posts: 38

I am experiencing something similar to Lester. I want to be able to do calculations on variables assigned to imported scripts using a different timeframe to the chart. But that does not seem possible.

Case study:

Script_A has the following formula to calculate the weekly value of the Bollinger Upper Band:

BB(Week(PERIODAMOUNT=1), BARS=9, DEFAULT=UpperLine, CALC=Close, STDDEV=2.000000);

When Script_A is plotted on a daily chart it behaves as expected. (It has a sort of ‘stepped’ look because it is only plotting the end-of-week value, which doesn’t change from Monday-Thursday).

Let’s now import Script_A into Script_B. Script_B looks like this:

BBWeeklyUpperLine = SCRIPT(SCRIPTNAME=Script_A);

BBWeeklyUpperLine

What happens on a daily chart with Script_B is that we get a huge sawtooth pattern because Script_B outputs 0 (zero) for Monday, Tuesday, Wednesday, Thursday and then the expected end-of-week value on Friday. If you take SPX for example, in the last few weeks you’ll see Script_B jump from zero to over 3,000 every Friday.

This makes it impossible to do weekly comparisons of variables assigned to imported scripts on a daily chart. For example, what is the difference between this week’s weekly Upper Bollinger Band and last week’s weekly Upper Bollinger Band? When on a weekly chart the formula is simple:

BBWeeklyUpperLine = SCRIPT(SCRIPTNAME=Script_A);

BBWeeklyUpperLine[0] – BBWeeklyUpperLine[1]

But if you use that same formula on a daily chart it compares today’s value to yesterday’s value, not this week’s end-of-week-value to last week’s end-of-week-value, even though the imported script was explicitly set to a weekly timeframe.

Has anyone had a similar experience or have any suggestions on how to overcome this?

Many thanks, Dean

 

Pin It on Pinterest