Like a time ago we designed a screener for Pop Gun patterns. For the sake of simplicity here is the screener for PG Long
PG = High[2]>High[1] and Low[2]<Low[1] and High>High[1] and Low<Low[1]
PGLong = PG and close>open
x = 0
IF PGLong Then
x = 1
Endif
SCREENER[x](x as "PG Long")
and the indicator
// PopGun Indikator
// coded by JohnScher
//for the graphics
PIP = 10*pipsize
LIN = 6
//percentrange = Support or Resistance in Percent og the Range High-Low = 25% default
//percentrange = 25 // default
Support = (High-Low)*percentrange/100
Resistance = (High-Low)*percentrange/100
//indicator PopGun
PG = High[2]>High[1] and Low[2]<Low[1] and High>High[1] and Low<Low[1]
// the second outside candle
PGLong = PG and Close>open // greencandle = long , as rerversal short
PGShort = PG and Close<Open //redcandle = short, as reversal long
// timewindow to show the popgun
// tstart = 080000 fefautl
// tend = 220000
//IF time >= tstart and time <= tend then
IF PGLong Then
rL=250
gL=0
bL=0
DRAWARROWUP(barindex,LOW-PIP)coloured(rL,gL,bL)
DRAWSEGMENT(barindex,LOW-SUPPORT,barindex+LIN, LOW-SUPPORT )coloured(rL,gL,bL)
// to trade as reversal red candle = Long
rs=0
gs=0
bs=250
DRAWARROWDOWN(barindex,HIGH+PIP)coloured(rs,gs,bs)
DRAWSEGMENT(barindex,High+Resistance,barindex+LIN, High+Resistance )coloured(rs,gs,bs)
Endif
IF PGShort then
rS=0
gS=0
bS=250
DRAWARROWDOWN(barindex,HIGH+PIP)coloured(rs,gs,bs)
DRAWSEGMENT(barindex,High+Resistance,barindex+LIN, High+Resistance )coloured(rs,gs,bs)
// to trade as reversal red candle = Long
rL=250
gL=0
bL=0
DRAWARROWUP(barindex,LOW-PIP)coloured(rL,gL,bL)
DRAWSEGMENT(barindex,LOW-SUPPORT,barindex+LIN, LOW-SUPPORT )coloured(rL,gL,bL)
ENDIF
//ENDIF
return
To check the result see: See at ScreenShot_a
…………….
My question is:
Does the following code
p = 5
PG = High[p+2]>High[p+1] and Low[p+2]<Low[p+1] and High [p]>High[p+1] and Low [p]<Low[p+1]
PGLong = PG and Close>open
d = 0.25 // distance 0.1 0.25 0.5 0.75 ...
distance = (High [p] - Low [p]) *d
q = p-1
c = Highest [q] (high) < (High [p] + distance)
x = 0
IF PGLong and c Then
x = 1
Endif
SCREENER[x](x as "PG")
screen all (long) PopGuns of the last 5 weeks that broke out above the high of the trigger candle and exceeded 25% of the range high-low of the trigger candle?
In use of the screener PG Long5 please see at ScreenShot_b
And if not, how would it be to program correctly?