The screener returns either a positive (for Bullish Pinbar) or negative (for Bearish Pinbar) value.
The value returned is based upon the number of bounces from the Lowest Close (for Bullish Pinbar) or the number of bounces from the Highest Close (for Bearish Pinbar).
The whole algorithm is based upon a look back period of 30.
There is also a parameter called t which says how far back to look for the pinbar (Default Value = 0 meaning only results where a pinar just formed is displayed).
Also, to increase the probability of success only bullish pinbars above the 200MA and bearish pinbars below the 200MA will be returned.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
//Defparam cumulateorders = False once t = 0 LBP = 30 //Look Back Period PSH = Highest[LBP](close)[2+t] //Previous Swing High PSL = Lowest[LBP](close)[2+t] //Previous Swing Low LMA = Average[200](close)[t] //Long Moving Avearge (Primary Trend) STC = Stochastic[14,3](close)[t] RS2 = RSI[2](close)[t] //PB = PinBar BullishPB = 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] Then PBTShadow = (high[1+t] - close[1+t]) PBBShadow = (open[1+t] - low[1+t]) ElsIf close[1+t] < open[1+t] Then PBTShadow = (high[1+t] - open[1+t]) PBBShadow = (close[1+t] - low[1+t]) EndIF PBRatio = 3 If BullishPB and PBBShadow > (PBTShadow*PBRatio) and PBBShadow > (PBBody*PBRatio) and low[1+t] < PSL and close[t] > PSL Then //and PBBody < (PBHeight/PBRatio) BullishPB = 1 BearishPB = 0 ElsIf BearishPB and PBTShadow > (PBBShadow*PBRatio) and PBTShadow > (PBBody*PBRatio) and high[1+t] > PSH and close[t] < PSH Then //and PBBody < (PBHeight/PBRatio) BearishPB = 1 BullishPB = 0 Else BearishPB = 0 BullishPB = 0 EndIf SupportB = 0 ResistanceB = 0 For i = (1+t) to (LBP+t) Do If low[i] < PSL Then SupportB = SupportB + 1 ElsIf high[i] > PSH Then ResistanceB = ResistanceB + 1 EndIf Next BullPinbar = (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 Then Pinbar = SupportB*1 //Number of Bounces from Support ElsIf BearPinbar Then Pinbar = ResistanceB*-1 //Number of Bounces from Resistance x -1 to denote Bearish Pinbar EndIf Condition = (BullPinbar Or BearPinbar) SCREENER[Condition] (Pinbar AS "Pinbar") |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
hi this doesnot seem to work on forex, any ideas? thanks.