Bollinger band and candle indicator

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #205748 quote
    Jdh320Jdh320
    Participant
    New
    Hello, would anyone be able to help. I was hoping to code an indicator that puts either a red (sell) or green (buy) marker above/below the candlesticks on the chart if the candle closes outside the Bollinger band and the next candle closes in the band via an engulfing candle (I define an engulfing candle as the body of the engulfing has a higher body high and a lower body low to that of the previous candle).   This indicator would be based off a standard 20SMA 2 standard deviation Bollinger band.   Please see attached link for a visual representation.   Many Regards   Joe   https://www.tradingview.com/x/qYkT2gNH/
    #205767 quote
    JSJS
    Participant
    Master

    Hi @jdh320

    Here is the indicator…  

    S1=Average[20](Close) //SMA 20 periods
    S2=Std[20](Close) // Standard Deviation 20 periods
    S3=Close[1]>Open[1] and Open>Close[1] and Close<Open[1] //Bearish Engulfing
    S4=Close[1]<Open[1] and Open<Close[1] and Close>Open[1] //Bullish Engulfing
    
    If Close[1] Crosses Over S1[1] + 2*S2[1] and S3 then
    DrawArrowDown(BarIndex,High+5*pipsize) Coloured(255,0,0)
    EndIf
    
    If Close[1] Crosses Under S1[1] - 2*S2[1] and S4 then
    DrawArrowUp(BarIndex,Low-5*pipsize) Coloured(0,255,0)
    EndIf
    
    Return S1 as "SMA[20]" Style(Dottedline), S1+2*S2 as "BB-Up" Coloured(255,0,0), S1-2*S2 as "BB-Down" Coloured(0,255,0) 

    Nicolas and Jdh320 thanked this post
    Scherm­afbeelding-2022-12-14-om-23.42.14.png Scherm­afbeelding-2022-12-14-om-23.42.14.png
    #205781 quote
    Jdh320Jdh320
    Participant
    New
    Ah thats great, thank you so much. Many Regards Joe
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Bollinger band and candle indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Jdh320 @jdh320 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Jdh320Jdh320
3 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/14/2022
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...