# Lookback function assistance

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

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

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.

Steve

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

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.

Thanks Darren much appreciated.

Steve