Bollinger Band Pinbar Indicator

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #207031 quote
    Jdh320
    Participant
    New

    Hello PRT Coders, Happy New Year. I hope you all enjoyed the festive break. Does anyone know if it is possible to code an indicator that draws an arrow above/below a sell/buy condition. The condition would be if price opens inside the bollinger band breaks outside of it and returns to close back in the band forming a pinbar?

    Please see attached photo (as I am sure I havn’t explained it well!!)

    Regards

     

    Joe

    #207032 quote
    JS
    Participant
    Senior

    Hé Joe, no attached photo…

    #207033 quote
    Jdh320
    Participant
    New

    Apologies here is the chart image.

     

    https://www.tradingview.com/x/RpzCXH2T/

    #207034 quote
    Jdh320
    Participant
    New

    Apologies, here is the link to the chart image.

     

    https://www.tradingview.com/x/RpzCXH2T/

    #207035 quote
    JS
    Participant
    Senior

    Hi Joe,

    That is possible…

    Probably a bullish pinbar (BBUp) and a bearish pinbar (BBDown)…

    #207041 quote
    Jdh320
    Participant
    New
    Thanks. Do you know anyone who would be able to code it as I have zero coding skill 😂😂 Joe
    #207045 quote
    JS
    Participant
    Senior
    I will code it for you… 😉
    #207046 quote
    Jdh320
    Participant
    New
    Oh nice one, thanks so much!
    #207047 quote
    JS
    Participant
    Senior

    Hi Joe,

    Here is the indicator…

       
    If Open<BollingerUp[20](close) and High>BollingerUp[20](Close) and Close<BollingerUp[20](Close) and Close>Open then //Bullish PinBar
    DrawArrowDown(BarIndex,High+20*pipsize) coloured("Red")
    EndIf
    
    If Open>BollingerDown[20](close) and Low<BollingerDown[20](Close) and Close>BollingerDown[20](Close) and Close<Open then //Bearish PinBar
    DrawArrowUp(BarIndex,Low-20*pipsize) Coloured("Green")
    EndIf
    Return
    #207049 quote
    Jdh320
    Participant
    New
    Thanks JS. That’s great. ATB Joe
    JS thanked this post
    #207050 quote
    Jdh320
    Participant
    New
    Hi JS I have had a little look and I think the code is almost right, I have attached a screenshot and annotated arrows where I would have expected them. so the candle opens inside the BB breaks outside and closes back inside. It can be both a bullish or a bearish pinbar in each scenario with a body height of I guess about 15% or less of the candle high minus low.
    #207058 quote
    JS
    Participant
    Senior

    Hi @jdh320,

    Hereby the adjusted indicator with both bullish and bearish pinbar breakthroughs…

    You can set the percentage of the body yourself (now stands at 30%) …

     

    If Open<BollingerUp[20](close) and High>BollingerUp[20](Close) and Close<BollingerUp[20](Close) and abs(Close-Open)<=0.30*(High-Low) then //Bullish PinBar
    DrawArrowDown(BarIndex,High+20*pipsize) coloured("Red")
    EndIf
    
    If Open>BollingerDown[20](close) and Low<BollingerDown[20](Close) and Close>BollingerDown[20](Close) and abs(Close-Open)<=0.30*(High-Low) then //Bearish PinBar
    DrawArrowUp(BarIndex,Low-20*pipsize) Coloured("Green")
    EndIf
    Return
    
    #207066 quote
    robertogozzi
    Moderator
    Master
    @Jdh320 Please do not embed pictures and files in your post, as it slows down the loading of pages. To attach them use the “Select File” button, instead. Thank you 🙂
    #207079 quote
    Jdh320
    Participant
    New
    Thanks so much, thats perfect. Regards Joe
    JS thanked this post
    #207081 quote
    Jdh320
    Participant
    New
    apologies @robertogozzi regards joe
    robertogozzi thanked this post
Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.

Bollinger Band Pinbar Indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Jdh320 @jdh320 Participant
Summary

This topic contains 14 replies,
has 3 voices, and was last updated by Jdh320
3 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/08/2023
Status: Active
Attachments: 3 files
Logo Logo
Loading...