Lookback function assistance

Optuma Forums Optuma Scripting Lookback function assistance

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #51671
    Steve
    • Topics: 5
    • Replies: 5
    • Posts: 10

    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
    • Topics: 40
    • Replies: 2,010
    • Posts: 2,050

    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
    Steve
    • Topics: 5
    • Replies: 5
    • Posts: 10

    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
    Steve
    • Topics: 5
    • Replies: 5
    • Posts: 10

    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
    • Topics: 67
    • Replies: 702
    • Posts: 769

    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
    Steve
    • Topics: 5
    • Replies: 5
    • Posts: 10

    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