Advanced Bullish/Bearish Pinbar Screener
Forums › ProRealTime English forum › ProScreener support › Advanced Bullish/Bearish Pinbar Screener
- This topic has 10 replies, 2 voices, and was last updated 6 years ago by GraHal.
-
-
12/16/2017 at 12:44 PM #55809
Great work juanj re the Screener, I have a question and I have made an attachment to make it easier for you to answer so I started this Thread based on your Library post here
https://www.prorealcode.com/prorealtime-market-screeners/advanced-bullishbearish-pinbar-screener/
How are bounces counted please? The image attached shows a pinbar result value = -4. I’ve numbered 7 bars for you to refer to. Are bounces counted if they are within a certain % of highest or how do you count 4 bounces from attached?
Everything is as your original code. Lookback is 30, but bars bars 1, 2, 3 and 4 (which are are bouncing / rejecting a level) would be within a Lookback of 7 so I am confused.
I can’t see exactly how the code arrives at a count of 4 in the code. If anyone else can see it then let me know please?
Thank You
GraHal12/16/2017 at 12:54 PM #55811I’m prob gonna answer my own question again (best way to learn! 🙂 )
Pinbar that has been detected is Bar 6 (bar 7 hasn’t closed yet and isn’t a pinbar anyway) but current mid-price is 9446 and there are 4 other pinbars (bars 1, 2, 3, and 4) showing a high within ‘1’ of 9446 … so is that how Juanj code gives a count of – 4??
GraHal
12/19/2017 at 11:44 AM #5605712/19/2017 at 11:52 AM #56058The best way to understand how the code works is to make it as an indicator, to better visualize when a new pinbar occurs and how it makes the bounces count:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859once t = 0LBP = 30 //Look Back PeriodPSH = Highest[LBP](close)[2+t] //Previous Swing HighPSL = Lowest[LBP](close)[2+t] //Previous Swing LowLMA = Average[200](close)[t] //Long Moving Avearge (Primary Trend)STC = Stochastic[14,3](close)[t]RS2 = RSI[2](close)[t]//PB = PinBarBullishPB = close[2+t] < open[2+t] and low[t] > low[1+t] and high[t] > high[1+t] and close[t] > close[1+t]//and close > open[2]BearishPB = close[2+t] > open[2+t] and low[t] < low[1+t] and high[t] < high[1+t] and close[t] < close[1+t]//and close < open[2]//PBHeight = High[1+t] - Low[1+t]PBBody = abs(close[1+t]-open[1+t])If close[1+t] > open[1+t] ThenPBTShadow = (high[1+t] - close[1+t])PBBShadow = (open[1+t] - low[1+t])ElsIf close[1+t] < open[1+t] ThenPBTShadow = (high[1+t] - open[1+t])PBBShadow = (close[1+t] - low[1+t])EndIFPBRatio = 3If BullishPB and PBBShadow > (PBTShadow*PBRatio) and PBBShadow > (PBBody*PBRatio) and low[1+t] < PSL and close[t] > PSL Then //and PBBody < (PBHeight/PBRatio)BullishPB = 1BearishPB = 0ElsIf BearishPB and PBTShadow > (PBBShadow*PBRatio) and PBTShadow > (PBBody*PBRatio) and high[1+t] > PSH and close[t] < PSH Then //and PBBody < (PBHeight/PBRatio)BearishPB = 1BullishPB = 0ElseBearishPB = 0BullishPB = 0EndIfSupportB = 0ResistanceB = 0For i = (1+t) to (LBP+t) DoIf low[i] < PSL ThenSupportB = SupportB + 1ElsIf high[i] > PSH ThenResistanceB = ResistanceB + 1EndIfNextBullPinbar = (BullishPB = 1 and close[t] > LMA and STC < 30 and RS2 > 50)BearPinbar = (BearishPB = 1 and close[t] < LMA and STC > 70 and RS2 < 50)If BullPinbar ThenPinbar = SupportB*1 //Number of Bounces from SupportElsIf BearPinbar ThenPinbar = ResistanceB*-1 //Number of Bounces from Resistance x -1 to denote Bearish PinbarEndIfCondition = (BullPinbar Or BearPinbar)return condition style(histogram) as "new pinbar", pinbar as "bounces"New pinbar condition is histogram, bounces count is a line.
I don’t know if it works correctly though…
12/19/2017 at 4:18 PM #56081I did a reply to this at about 12:20 pm today, I pressed submit and then all I saw was ‘no reply submitted’ and I was logged out. Strange??
Happened to me once before over 12 months ago, not ever since. Thought I’d say anyway for the record.
Same ever happen to anybody reading this??
12/19/2017 at 4:24 PM #56083This a shortened version of the reply I lost (maybe shorter is better! 😉 ) … I don’t think the Indicator is working Nicolas?
The line shows -4 (see attached) so 4 bounces supposedly (?) but I can see only 1 bounce within the lookback period of 30 … the pinbar before the ‘histo pinbar’?
GraHal
12/19/2017 at 5:06 PM #56088Sorry GraHal, I made so many little modifications on the website actually, that sometimes I need to reboot/purge/delete/replace files, etc.. and I can’t do it at night while people are sleeping ’cause I’m sleeping too 🙂
Well, this screener’s code is not mine and I’m hardly understand how @juanj has made it. I know he’s on vacation and he’ll be back in January. In the meantime I may have a look between other things like eating roasted turkeys and opening my christmas gifts (if I got some … not sure I been kind enough this year ..).
12/19/2017 at 6:35 PM #56097HAHAHAHA Thank you Nicolas … You’ve been kind enough to all of us anyway … so I hope you get many presents to open!!
Thank you for letting me know Juanj is on hols, cos sometimes I get involved where I see that a member of the Community has put in a lot of effort re coding us a great Screener or Strategy etc and no-one seems to be using the code / even care / say thank you etc. In this instance (as I started a Forum Thread for Juanj Screener) I was thinking … why won’t you answer Juanj … now I know why – he’s on hols! 🙂
Also you have answered me a question (that was in my ‘lost comment’ earlier) … often I think, why am I struggling to decipher how this code works, a skilled coder on here could tell me in 2 or 3 mins! But seems it’s not even easy when you are as good as you are! I know you could of course, but even for you it can take time so I might struggle a bit more now!
All the Best for Christmas
GraHal12/20/2017 at 10:12 AM #56117a skilled coder on here could tell me in 2 or 3 mins! But seems it’s not even easy when you are as good as you are!
Sometimes I got problems to understand things I’ve coded myself many months before!
About the pinbar pattern bounces on support/resistance, the easier way for me would be to recode the whole concept my own style, but I don’t want to throw away the work @juanj has made with his own view.
1 user thanked author for this post.
12/20/2017 at 11:35 AM #56129Sure let’s leave it until Junaj gets back off hols … maybe he’s skiiing or soaking up the sun on Bora Bora … all paid for with winnings from his Screener! 🙂
I’m running the Screener and it sure does look like I said in #55811 Screener detects a pinbar and if the price level + or – ‘1’ (of high or low bull / bear pin) has been hit by a previous pinbar then the Screener counts 1, 2, 3 0r -1, -2, -3 etc. Seems it doesn’t have to be hitting the same price level to add to the count, just so long as it is within ‘1’ of the previous pinbar / bounce … very clever!?
So a higher count could mean a higher confidence of a reversal!? However, if the price level at which the bounce occurs is progressively increasing (for a bearish reversal) then it may just shoot through (the price zone) after all and become a bullish breakout!? Always wait for the next bar for confirmation of direction.
Thought I’d say above to save skilled coders spending too much time working out Juanj original code.
Best to All
GraHal12/20/2017 at 5:06 PM #56159 -
AuthorPosts
Find exclusive trading pro-tools on