How do I apply a Weekly Time Frame override

Optuma Forums Optuma Scripting How do I apply a Weekly Time Frame override

  • This topic has 2 replies, 2 voices, and was last updated 2 years ago by Dean.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #51975
    Lester
    • Topics: 24
    • Replies: 39
    • Posts: 63

    I have an entry signal that works on both daily and weekly time frame.  I now wish to run this entry on a daily time frame, but still have my entry script use the weekly time frame criteria for entry.  My aim is to be able to use a daily time frame exit signal rather than the weekly one.

    Here is the signal that works

    UpDiff = Close() – Close(OFFSET=1);

    DownDiff = Close(OFFSET=1) – Close();

    UpDay = Acc(IF(UpDiff > 0, UpDiff, 0), RANGE=Look Back Period, BARS=14);

    DownDay = Acc(IF(DownDiff > 0, DownDiff, 0), RANGE=Look Back Period, BARS=14);

    IndexVal=100-(100/(1+(UpDay/(DownDay+0.0001))));

    NZU=IndexVal-55;

    UC=IndexVal-70;

    NeutUp=CLOSE()-(CLOSE()*(NZU/100));

     

    Close() > NeutUp and CLOSE(OFFSET=1) <= OFFSET(NeutUp, OFFSET=1)

    and CLOSE() > WVS()

     

    Unfortunately my time frame over ride using the WEEK() or the CLOSE(Week(PERIODAMOUNT=1)) does not produce any signals.  Does anyone know the correct way to implement a weekly time frame override?

    #52019
    Lester
    • Topics: 24
    • Replies: 39
    • Posts: 63

    I have now sorted the problem. It would not work because the ACC() function on line four did not need an override.

    Lester

    #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

     

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest