Dynamic Market Profile Script

I'm trying to create a script using the Dynamic Market Profile (DMPA) but I can't seem to make it work. Maybe my problem is the OFFSET function doesn't seem exist within the DMPA, so I'm unsure how to proceed. Here is my thinking followed by my script - perhaps you can enlighten me on what I'm doing wrong.

BUY when:
The last three Closes are above the last three Opens (e.g. 3 white candles); all of the Opens and Closes are above the DMPA Point of Control (bars=20).
SELL when:
The last two Closes were below the DMPA Point of Control (bars=20) (regardless of whether they're white candles or not.

My BUY Script:
var1 = CLOSE() > OPEN();
var2 = CLOSE(OFFSET=1) > OPEN(OFFSET=1);
var3 = CLOSE(OFFSET=2) > OPEN(OFFSET=2);
CLOSE(OFFSET=2) > DMPA(DEFAULT=PointOfControl, BARS=20); and
CLOSE(OFFSET=1) > DMPA(DEFAULT=PointOfControl, BARS=20); and
CLOSE() > DMPA(DEFAULT=PointOfControl, BARS=20); and
var1 + var2 + var3 ==3

My SELL Script:
CLOSE(OFFSET=1) < DMPA(DEFAULT=PointOfControl, BARS=20); and
CLOSE() < DMPA(DEFAULT=PointOfControl, BARS=20)

Cheers
Fabien

Hi Fabien,

Thank you for your post.

Rather than using Offsets i would suggest using the ACC() function. I’ve included an example of the adjusted buy script below:

//Find 3 Closes greater than Opens in a row
V1 = CLOSE() > OPEN() ;
V2 = ACC(V1, RANGE=Look Back Period, BARS=3) == 3;
//Find 3 Closes and Opens greater than DMPA POC in a row
V3 = DMPA(DEFAULT=PointOfControl, BARS=20) ;
V4 = CLOSE() > V3 and OPEN() > V3 ;
V5 = ACC(V4, RANGE=Look Back Period, BARS=3) == 3;
//Find both setups at the same time
V2 and V5

The shaded green vertical zones show bars that pass the above criteria:

Ex7

You can use the ACC() function to create a similar Sell script.