Pocket pivot indicator

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #156159 quote
    Alfy
    Participant
    Average

    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

    daystoconfirmuptrend = 50
    cPrc1 = (close > Average[daysToConfirmUpTrend](close) AND Close > open)
    maxDay = 10
    maxDownDay = 0
    maxdown = 0
    FOR d = 1 TO maxDay DO
    r = Close[d] - open[d]
    IF r <0 and volume[d]> maxDown THEN
    maxDown = volume[d]
    maxDownDay = d
    ENDIF
    
    NEXT
    
    IF maxDownday = 0 THEN
    maxDowndayVol=0
    ELSE
    maxDowndayvol = volume[maxdownday]
    ENDIF
    
    cVol2 = (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"
    
    #156167 quote
    Vonasi
    Moderator
    Master

    is 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?

    Alfy thanked this post
    #156169 quote
    Alfy
    Participant
    Average

    Sorry, i wasnt clear. i mean greater than the largest volume down day in the last 10 down days. Thanks for your reply!

    #156172 quote
    Vonasi
    Moderator
    Master

    This code checks for greater than the largest volume day in the last 10 down days. I left all your other conditions in the code.

    daystoconfirmuptrend = 50
    cPrc1 = (close > Average[daysToConfirmUpTrend](close) AND Close > open)
    maxDay = 10
    maxDownDayVol = 0
    maxdown = 0
    count = 0
    if barindex >= maxday then
    FOR d = 1 TO barindex DO
    IF Close[d] < open[d] THEN
    count = count + 1
    maxDownDayVol = max(volume[d],maxdowndayvol)
    if count = maxday then 
    break
    endif
    ENDIF
    NEXT
    
    cVol2 = (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))
    endif
    
    RETURN ind1 COLOURED (0,0,200) AS "Pivot Pocket"
    Alfy thanked this post
    #156173 quote
    Alfy
    Participant
    Average

    wow, thanks so much

    #156174 quote
    Vonasi
    Moderator
    Master

    This 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!

    daystoconfirmuptrend = 50
    cPrc1 = (close > Average[daysToConfirmUpTrend](close) AND Close > open)
    maxDay = 10
    maxDownDayVol = 0
    maxdown = 0
    count = 0
    if barindex >= maxday then
    FOR d = 1 TO barindex DO
    IF Close[d] < open[d] THEN
    count = count + 1
    maxDownDayVol = maxdowndayvol+volume[d]
    if count = maxday then
    break
    endif
    ENDIF
    NEXT
    
    cVol2 = (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))
    endif
    
    RETURN ind1 COLOURED (0,0,200) AS "Pivot Pocket"
    
    #156178 quote
    Vonasi
    Moderator
    Master

    I 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.

    maxDay = 10
    maxDownDayVol = 0
    count = 0
    if barindex >= maxday then
    FOR d = 1 TO barindex DO
    IF Close[d] < open[d] THEN
    count = count + 1
    maxDownDayVol = max(volume[d],maxdowndayvol)
    if count = 10 then
    break
    endif
    ENDIF
    NEXT
    
    ind1 = (volume > maxDownDayvol) and (close > open)
    endif
    
    RETURN ind1 COLOURED (0,0,200) AS "Pivot Pocket"
    
    Alfy thanked this post
    #156179 quote
    Alfy
    Participant
    Average

    Fabulous, thanks so much for your help.

    #156298 quote
    Alfy
    Participant
    Average

    One final question if i may? How does one turn the indicator into a screener please?

    daystoconfirmuptrend = 50
    cPrc1 = (close > Average[daysToConfirmUpTrend](close) AND Close > open)
    maxDay = 10
    maxDownDayVol = 0
    maxdown = 0
    count = 0
    if barindex >= maxday then
    FOR d = 1 TO barindex DO
    IF Close[d] < open[d] THEN
    count = count + 1
    
    maxDownDayVol = max(volume[d],maxdowndayvol)
    if count = maxday then 
    break
    endif
    ENDIF
    NEXT
     
    cVol2 = (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))
    endif
     
    RETURN ind1 COLOURED (0,0,200) AS "Pivot Pocket"
    #156314 quote
    Vonasi
    Moderator
    Master

    Just call it from a screener:

    result = call "Pocket Pivot"
    SCREENER[result]

    Change the name from Pocket Pivot if you have called the indicator something different.

    Alfy thanked this post
    #156326 quote
    Alfy
    Participant
    Average

    Sorry, 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

    daystoconfirmuptrend = 50
    cPrc1 = (close > Average[daysToConfirmUpTrend](close) AND Close > open)
    maxDay = 10
    maxDownDayVol = 0
    maxdown = 0
    count = 0
    if barindex >= maxday then
    FOR d = 1 TO barindex DO
    IF Close[d] < open[d] THEN
    count = count + 1
    maxDownDayVol = max(volume[d],maxdowndayvol)
    if count = maxday then
    break
    endif
    ENDIF
    NEXT
     
    cVol2 = (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))
    endif
     
    screener[ind1]
    
    #156329 quote
    Vonasi
    Moderator
    Master

    Just delete line 5.

    #156333 quote
    Alfy
    Participant
    Average

    Thanks so much!

    #156341 quote
    Alfy
    Participant
    Average

    Sir, 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?

    maxDay = 10
    maxDownDayVol = 0
    maxdown = 0
    count = 0
    if barindex >= maxday then
    FOR d = 1 TO barindex DO
    IF Close[d] < open[d] THEN
    count = count + 1
    maxDownDayVol = max(volume[d],maxdowndayvol)
    if count = maxday then
    break
    endif
    ENDIF
    NEXT
     
    cVol2 = (volume > maxDownDayvol)
    
    endif
     
    RETURN cVol2 COLOURED (0,0,200)
    
    #156344 quote
    Vonasi
    Moderator
    Master

    The code you posted is not the same as I posted in this post:

    Pocket pivot indicator

    Look at line 16 – there is an additional condition for this current candle being green.

Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.

Pocket pivot indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Alfy @alfy Participant
Summary

This topic contains 18 replies,
has 2 voices, and was last updated by Vonasi
5 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/04/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...