Pocket pivot indicator
Forums › ProRealTime English forum › ProBuilder support › Pocket pivot indicator
- This topic has 18 replies, 2 voices, and was last updated 4 years ago by Vonasi.
-
-
01/04/2021 at 10:14 AM #156159
Good morning guys, happy new year. i found this code for the “pocket pivot” indicator on the site but i think its coded incorrectly and i wondered if one of you guys could help me fix it please? The indicator should find when the volume of a stock on an “up day” is greater than the volume of the last 10 days “down days.” I believe the code I’ve posted just looks back at the last 10 days rather than the last 10 days “down days.” Any help as always would be appreciated.
Best regards
Pocket pivot indicator123456789101112131415161718192021222324252627daystoconfirmuptrend = 50cPrc1 = (close > Average[daysToConfirmUpTrend](close) AND Close > open)maxDay = 10maxDownDay = 0maxdown = 0FOR d = 1 TO maxDay DOr = Close[d] - open[d]IF r <0 and volume[d]> maxDown THENmaxDown = volume[d]maxDownDay = dENDIFNEXTIF maxDownday = 0 THENmaxDowndayVol=0ELSEmaxDowndayvol = volume[maxdownday]ENDIFcVol2 = (volume > maxDownDayvol)Cprc2 = (close >= Average[20](close))Cprc3 = (close CROSSES OVER Average[10](close) OR Close CROSSES OVER Average[50](close))cPrc11 = (close > (high + low) *0.5)Cprc13 = (close[1] < highest[65](close))ind1 = (cPrc1 AND cPrc2 AND (cPrc3 OR 1) AND cVol2 AND (cPrc11 OR 1) AND (cPrc13 OR 1))RETURN ind1 COLOURED (0,0,200) AS "Pivot Pocket"01/04/2021 at 10:41 AM #156167is greater than the volume of the last 10 days “down days.”
Do you mean greater than the last 10 down days volumes combined or greater than the largest volume day in the last 10 down days?
1 user thanked author for this post.
01/04/2021 at 10:47 AM #15616901/04/2021 at 10:50 AM #156172This code checks for greater than the largest volume day in the last 10 down days. I left all your other conditions in the code.
1234567891011121314151617181920212223242526daystoconfirmuptrend = 50cPrc1 = (close > Average[daysToConfirmUpTrend](close) AND Close > open)maxDay = 10maxDownDayVol = 0maxdown = 0count = 0if barindex >= maxday thenFOR d = 1 TO barindex DOIF Close[d] < open[d] THENcount = count + 1maxDownDayVol = max(volume[d],maxdowndayvol)if count = maxday thenbreakendifENDIFNEXTcVol2 = (volume > maxDownDayvol)Cprc2 = (close >= Average[20](close))Cprc3 = (close CROSSES OVER Average[10](close) OR Close CROSSES OVER Average[50](close))cPrc11 = (close > (high + low) *0.5)Cprc13 = (close[1] < highest[65](close))ind1 = (cPrc1 AND cPrc2 AND (cPrc3 OR 1) AND cVol2 AND (cPrc11 OR 1) AND (cPrc13 OR 1))endifRETURN ind1 COLOURED (0,0,200) AS "Pivot Pocket"1 user thanked author for this post.
01/04/2021 at 10:54 AM #15617301/04/2021 at 10:55 AM #156174This does the other option. It is unlikely to get many hits as adding together the volume of 10 down day candles equals a lot of volume to have in just one up candle!
1234567891011121314151617181920212223242526daystoconfirmuptrend = 50cPrc1 = (close > Average[daysToConfirmUpTrend](close) AND Close > open)maxDay = 10maxDownDayVol = 0maxdown = 0count = 0if barindex >= maxday thenFOR d = 1 TO barindex DOIF Close[d] < open[d] THENcount = count + 1maxDownDayVol = maxdowndayvol+volume[d]if count = maxday thenbreakendifENDIFNEXTcVol2 = (volume > maxDownDayvol)Cprc2 = (close >= Average[20](close))Cprc3 = (close CROSSES OVER Average[10](close) OR Close CROSSES OVER Average[50](close))cPrc11 = (close > (high + low) *0.5)Cprc13 = (close[1] < highest[65](close))ind1 = (cPrc1 AND cPrc2 AND (cPrc3 OR 1) AND cVol2 AND (cPrc11 OR 1) AND (cPrc13 OR 1))endifRETURN ind1 COLOURED (0,0,200) AS "Pivot Pocket"01/04/2021 at 11:02 AM #156178I notice that your description requires an up day – this is not in the original code! Here is a pure version that just does what you ask for. It looks for a green day that has volume greater than the biggest volume in the last ten down days.
123456789101112131415161718maxDay = 10maxDownDayVol = 0count = 0if barindex >= maxday thenFOR d = 1 TO barindex DOIF Close[d] < open[d] THENcount = count + 1maxDownDayVol = max(volume[d],maxdowndayvol)if count = 10 thenbreakendifENDIFNEXTind1 = (volume > maxDownDayvol) and (close > open)endifRETURN ind1 COLOURED (0,0,200) AS "Pivot Pocket"1 user thanked author for this post.
01/04/2021 at 11:15 AM #15617901/04/2021 at 4:46 PM #156298One final question if i may? How does one turn the indicator into a screener please?
Pocket pivot123456789101112131415161718192021222324252627daystoconfirmuptrend = 50cPrc1 = (close > Average[daysToConfirmUpTrend](close) AND Close > open)maxDay = 10maxDownDayVol = 0maxdown = 0count = 0if barindex >= maxday thenFOR d = 1 TO barindex DOIF Close[d] < open[d] THENcount = count + 1maxDownDayVol = max(volume[d],maxdowndayvol)if count = maxday thenbreakendifENDIFNEXTcVol2 = (volume > maxDownDayvol)Cprc2 = (close >= Average[20](close))Cprc3 = (close CROSSES OVER Average[10](close) OR Close CROSSES OVER Average[50](close))cPrc11 = (close > (high + low) *0.5)Cprc13 = (close[1] < highest[65](close))ind1 = (cPrc1 AND cPrc2 AND (cPrc3 OR 1) AND cVol2 AND (cPrc11 OR 1) AND (cPrc13 OR 1))endifRETURN ind1 COLOURED (0,0,200) AS "Pivot Pocket"01/04/2021 at 5:41 PM #15631401/04/2021 at 6:40 PM #156326Sorry, im sure im doing something stupid but i get a syntax error “This variable is not used in the code:maxdown”. Would you mind taking a look and tell me where im going wrong?
Thanks for all your help.Best regards
Pocket pivot screener1234567891011121314151617181920212223242526daystoconfirmuptrend = 50cPrc1 = (close > Average[daysToConfirmUpTrend](close) AND Close > open)maxDay = 10maxDownDayVol = 0maxdown = 0count = 0if barindex >= maxday thenFOR d = 1 TO barindex DOIF Close[d] < open[d] THENcount = count + 1maxDownDayVol = max(volume[d],maxdowndayvol)if count = maxday thenbreakendifENDIFNEXTcVol2 = (volume > maxDownDayvol)Cprc2 = (close >= Average[20](close))Cprc3 = (close CROSSES OVER Average[10](close) OR Close CROSSES OVER Average[50](close))cPrc11 = (close > (high + low) *0.5)Cprc13 = (close[1] < highest[65](close))ind1 = (cPrc1 AND cPrc2 AND (cPrc3 OR 1) AND cVol2 AND (cPrc11 OR 1) AND (cPrc13 OR 1))endifscreener[ind1]01/04/2021 at 6:57 PM #15632901/04/2021 at 7:05 PM #15633301/04/2021 at 7:23 PM #156341Sir, im sorry to be a pain…i just took a look at the indicator you kindly helped me with and it doesn’t seem to do what i wanted it to. I wanted it to tell me: if volume on a up day was greater than the highest volume of the previous 10 down days. I just looked manually at an ETF (PHSP) which i think should have done this today but the indicator didnt pick it up?
pocket pivot indicator1234567891011121314151617181920maxDay = 10maxDownDayVol = 0maxdown = 0count = 0if barindex >= maxday thenFOR d = 1 TO barindex DOIF Close[d] < open[d] THENcount = count + 1maxDownDayVol = max(volume[d],maxdowndayvol)if count = maxday thenbreakendifENDIFNEXTcVol2 = (volume > maxDownDayvol)endifRETURN cVol2 COLOURED (0,0,200)01/04/2021 at 8:50 PM #156344The code you posted is not the same as I posted in this post:
https://www.prorealcode.com/topic/pocket-pivot-indicator/#post-156178
Look at line 16 – there is an additional condition for this current candle being green.
-
AuthorPosts
Find exclusive trading pro-tools on