# 40/3 Pullback Strategy

Hi,
This back test is unique in that the sell signal uses criteria from the buy signal set a profit target and also a stoploss price.I think I am on the way to getting the buy signal correct (it is not correct at the moment).However, the sell signal is defiantly not working.
A through description of the 40/3 Pullback Strategy starts on page 19 of the attached PDF.

Note I have used “offsets” in the formula and used the 40 bar high as the datum (i.e. zero offset). Any help is welcome.

Cheers, Lester

```HH1 = HIGH() > (HIGHESTHIGH(BARS=39));
3LowerLows=LOW() > LOW(OFFSET=1) and LOW(OFFSET=1) > LOW(OFFSET=2) and LOW(OFFSET=2) > LOW(OFFSET=3);
4thDayReversal=CLOSE(OFFSET=4)>1.005*CLOSE(OFFSET=3) and CLOSE(OFFSET=4)>0.8*(HIGH(OFFSET=3)-LOW(OFFSET=3))+LOW(OFFSET=3);
SIGNALAFTER(HH1) and SIGNALAFTER(3LowerLows) and SIGNALAFTER(4thDayReversal) and BuyStop```

40/3 Pullback Strategy SELL

```HH1 = HIGH() > (HIGHESTHIGH(BARS=39)) ;
3LowerLows=LOW() > LOW(OFFSET=1) and LOW(OFFSET=1) > LOW(OFFSET=2) and LOW(OFFSET=2) > LOW(OFFSET=3);
4thDayReversal=CLOSE(OFFSET=4)>1.005*CLOSE(OFFSET=3) and CLOSE(OFFSET=4)>0.8*(HIGH(OFFSET=3)-LOW(OFFSET=3))+LOW(OFFSET=3);
StopLoss=LOW(OFFSET=3);
SIGNALAFTER(HH1) and SIGNALAFTER(3LowerLows) and SIGNALAFTER(4thDayReversal) and SIGNALAFTER(BuyStop) and LOW()>ProfitTarget
or
SIGNALAFTER(HH1) and SIGNALAFTER(3LowerLows) and SIGNALAFTER(4thDayReversal) and SIGNALAFTER(BuyStop) and LOW()< StopLoss```

Thanks Lester.

The best way to build a script is in its component parts as a Show Bar or Show View so you can see they are doing what you expect them to be doing. See this video for more:

https://www.optuma.com/verify-scripts/

This is quite a complex request and beyond the scope of usual support, but here’s what I came up with for the entry. If you want more help with the sell then we can arrange a scripting consultation, starting at \$100 an hour.

Apply this to a Show Bar and let us know how you go:

```// is it a new 40 day high
v1 = HIGH() > HIGHESTHIGH(BARS=40);
//was the high 4 days ago?
v2 = TIMESINCESIGNAL(v1) == 4;
//are previous lows lower?
v3 = LOW(OFFSET=1) < LOW(OFFSET=2) and LOW(OFFSET=2) < LOW(OFFSET=3) and LOW(OFFSET=3)<LOW(OFFSET=4);
//is current close higher?
v4 = CLOSE() IsUp;
//is close in top 20% of bar?
v5 = CLOSE() > (LOW()+(HIGH() - LOW())*0.8);
//show when conditions are true
v2 and v3 and v4 and v5

```