Stock screener based on Williams Highs and Lows indicator made by @gabri
//Williams SwingPoints
// 20-11-2017
// Violet, extension of on Gabri's algo
//Test for insidebar
insidebar = high < high[1] and low > low[1]
if not insidebar and high > alto[1] then
alto = high
basso = low
markup = barindex
markhigh = high
endif
if not insidebar and low < basso[1] then
alto = high
basso = low
markdown = barindex
marklow = low
endif
if alto < alto[1] and trend = 1 then
trend = 0
thisbar = markup
mediummarkup = shortmarkup
shortmarkup = markup
longmarkhigh = mediummarkhigh
mediummarkhigh = shortmarkhigh
shortmarkhigh = markhigh
if longmarkhigh < mediummarkhigh and mediummarkhigh > shortmarkhigh then
longmarkUpset = 1
thisbar = mediummarkup
else
longmarkUpset = 0
endif
endif
if basso > basso[1] and trend = 0 then
trend = 1
thisbar = markdown
mediummarkdown = shortmarkdown
shortmarkdown = markdown
longmarklow = mediummarklow
mediummarklow = shortmarklow
shortmarklow = marklow
if longmarklow > mediummarklow and mediummarklow < shortmarklow then
longmarkDownset = 1
thisbar = mediummarkdown
else
longmarkDownset = 0
endif
endif
whichbar = barindex - thisbar
LookbackPeriods = 1
signalUP1 = trend = 1 and not longmarkUPset and whichbar <= LookbackPeriods
signalUp2 = trend = 1 and longmarkUpset and whichbar <= LookbackPeriods
signalDn1 = trend = 0 and not longmarkDownset and whichbar <= LookbackPeriods
signalDn2 = trend = 0 and longmarkDownset and whichbar <= LookbackPeriods
if signalup1 then
type = 1 // arrowup
elsif signalup2 then
type = 2 // ellipse at bottom
elsif signalDn1 then
type = -1 // arrowdown
elsif signalDn2 then
type = -2 // ellipse at top
endif
signal = SignalUP1 OR signalUP2 or SignalDn1 OR signalDn2
screener [ signal ] sort by type
You must be logged in to post a comment.
Abz, the arrows and circles are only the *first part* of a trade setup. If certain conditions are met (as defined in the algorithm), then the signal comes on the bar/candle immediately following the arrow/circle, which forms the *second part* of the setup. Please carefully read the comments/discussions on the "Wlliams' Highs And Lows" indicator, presented by Gabri, on which this screener is based. It is by design that the actual trade signal (entry or exit point) can only come on the following bar/candle. The two bars/candles work in tandem to produce the signal. Mind you, never use indicators and screeners if you do not know exactly what conditions they are searching for.
if (high>alto[1]) and not (highlow[1]) then alto=high basso=low markup=barindex markhigh=high endif if (low<basso[1]) and not (highlow[1]) then alto=high basso=low markdown=barindex marklow=low endif if alto<alto[1] and trend=1 then trend=0 mediummarkup=shortmarkup shortmarkup=markup longmarkhigh=mediummarkhigh mediummarkhigh=shortmarkhigh shortmarkhigh=markhigh //intermediate high swing points if longmarkhighshortmarkhigh then imhighold=imhighnew imhighnew=mediummarkhigh //refhigh=shortmarkup endif if imhighold>imhighnew then refhigh=mediummarkup endif endif if basso>basso[1] and trend=0 then trend=1 mediummarkdown=shortmarkdown shortmarkdown=markdown longmarklow=mediummarklow mediummarklow=shortmarklow shortmarklow=marklow //intermediate low swing points if longmarklow>mediummarklow and mediummarklow<shortmarklow then imlowold=imlownew imlownew=mediummarklow //reflow=shortmarkdown endif if imlowold<imlownew then reflow=mediummarkdown endif endif //long conditions c1=imlowold=mediummarklow //short conditions c2=imhighold>imhighnew and (highest[barindex-refhigh+1](high))<=mediummarkhigh screener[c1 and not c2] (c1)
HI GABRI, if the cirled arrow is the intermediate point in which You can define your entry and stop loss what is the meaning of the other arrows (without circle)?