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
JSParticipant
Senior
Hé Joe, no attached photo…
Apologies, here is the link to the chart image.
https://www.tradingview.com/x/RpzCXH2T/
JSParticipant
Senior
Hi Joe,
That is possible…
Probably a bullish pinbar (BBUp) and a bearish pinbar (BBDown)…
Thanks. Do you know anyone who would be able to code it as I have zero coding skill 😂😂
Joe
JSParticipant
Senior
I will code it for you… 😉
Oh nice one, thanks so much!
JSParticipant
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
Thanks JS.
That’s great.
ATB
Joe
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.
JSParticipant
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
@
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 🙂
Thanks so much, thats perfect.
Regards
Joe