Lookback function assistance

Optuma Forums Optuma Scripting Lookback function assistance

This topic contains 5 replies, has 3 voices, and was last updated by Avatar Steve 2 months, 1 week ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #51671
    Avatar
    Steve
    • Topics: 3
    • Replies: 4
    • Posts: 7

    Good day, I can’t seem to find what I’m looking for on the forum or in the scripting documentation. I would like to calculate the following looking back 50 bars for the lowest value which would then be the scan pass/fail:
    MA(VOLUME(),BARS=50, CALC=CLOSE,0) * MA(BARS=50, CALC=Close) > number

    I suppose I need a LOOKBACK function which does the calculation for each of the 50 bars but can’t seem to find the function I need. 
    Hope someone can help.

    Thank you

    Steve

    #51675
    Mathew
    Mathew
    • Topics: 16
    • Replies: 967
    • Posts: 983

    Hi Steve,

    I’ve read this a few times now and I can not really make sense of what you are looking for. Can you put it on a chart and manually add what it is?

    All the best

    Mathew

    #51719
    Avatar
    Steve
    • Topics: 3
    • Replies: 4
    • Posts: 7

    Thank you Mathew I appreciate your time. I have attached a copy of a charted version of the formula which is a plot of the 50barMA Vol * 50bar MA Close. On the chart I have marked the lowest value date of that calculation.

    What I would like to do is scan for stocks looking back 50 bars from today with a lowest low value (of that calculation) not less than or greater than (number).

    Hope that makes sense.

    Thanks again.

    Steve50dayMAVolx50dayMAClose

    #51723
    Avatar
    Steve
    • Topics: 3
    • Replies: 4
    • Posts: 7

    Further to my last Mathew

    Mathew I think I found the solution to my question, seems obvious now – sorry, however may I check that with you;

    LOWESTLOW(MA(VOLUME(),BARS=50, CALC=CLOSE) * MA(BARS=50, CALC=Close), LOOKBACK BARS=50);

    Would this achieve the above chart result?

    Thank you

    Steve

    #51727
    Darren
    Darren
    • Topics: 36
    • Replies: 211
    • Posts: 247

    Hi Steve,

    Yes the LOWESTLOW is the way to go, although using a variable might be better:

    V1 = MA(VOLUME(),BARS=50, CALC=CLOSE) * MA(BARS=50, CALC=Close);

    LOWESTLOW(V1, BARS=50)

    To verify, put the formula in a Show View and it will plot the value.

    #51799
    Avatar
    Steve
    • Topics: 3
    • Replies: 4
    • Posts: 7

    Thanks Darren much appreciated.

    Steve

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close