Simple real candle body outside Bollinger Band screener please?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #18970 quote
    Brandon65
    Participant
    New

    Hello all, would any of you be so generous to help me code a screener that detects when the real body (high-low) of the current candle is outside of the Bollinger Bands with user-defined Bollinger Band length and Standard Deviation?  Thank you so much 🙂

    #18972 quote
    Brandon65
    Participant
    New

    Oh also, my (high-low) statement does not mean high minus low. I meant basically the high and low of the candle (real body) are outside of the bollinger bands(either above or below). Thank you 🙂

    #18991 quote
    Nicolas
    Keymaster
    Master

    Please find below the code that detects whenever the High and Low of the current candlesticks is above the upper Bollinger Band or below the lower Bollinger Band.

    Parameters of the Bollinger Bands can be changed at will in the code (period of the moving average, applied price and deviation coefficient of the bands).

    Example attached.

    // --- Bollinger Bands parameters
    period = 20
    data = close
    dev = 2
    // ---
    
    MA = average[period](data)
    BolUp = MA+STD[period]*dev
    BolDn = MA-STD[period]*dev
    
    condition = (high>BolUp and low>Bolup) or (high<BolDn and low<BolDn)
    
    SCREENER [condition]

    Let us know if it’s working properly on your side.

    sly45 thanked this post
    outside-bollinger-bands.png outside-bollinger-bands.png
    #19009 quote
    Brandon65
    Participant
    New

    Thank you so much Nicolas, it works perfectly when I run the scan! I have one more question 🙂 How do I make the Bollinger Band EMA-based, instead of SMA? Thanks again Sir!

    #19014 quote
    Nicolas
    Keymaster
    Master

    Just replace the word ‘average’  by ‘exponentialaverage’ and you’ll get a quicker and more reactive Bollinger bands 🙂

    Brandon65 thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Simple real candle body outside Bollinger Band screener please?


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Brandon65 @brandon65 Participant
Summary

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

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 12/22/2016
Status: Active
Attachments: No files
Logo Logo
Loading...