Closed Bars with Low < Bollinger or High > Bollinger

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6789 quote
    HenryHenry
    Participant
    Average

    A request that was addressed to ProRealTime:

    I am using a Bollinger Band indicator with SMA5 and 1,8 deviation.
    I was trying to implement a screener to show occurrencies of closed Bars with Low < Boll- or High > Boll+.
    I tried to use the automatic code builder, then adjusted it a bit, but t seems not to work as expected.
    How should it be modified to work properly?

    Suggestion for an anwser:

    p=5 //time period calculation of bollinger
    s=1.8 //standard deviation
    REM Calculate the moving average of Bollinger and the standard deviation 
    moyenneBollinger = AVERAGE[p](CLOSE)
    
    REM Define standard deviation (can also be done using the STD fonction)
    
    IF BARINDEX >= p-1 THEN
    sumy2 = 0
    sumy = 0
    FOR i = 0 TO p-1
    sumy2 = sumy2 + SQUARE(CLOSE[i])
    sumy = sumy + CLOSE[i]
    NEXT
    
    ecartType = SQRT(sumy2 / p - SQUARE(sumy / p))
    ELSE
    
    ecartType = UNDEFINED
    ENDIF
    
    REM Deduce Bollinger
    bollSup = moyenneBollinger + s * ecartType
    bollInf = moyenneBollinger - s * ecartType
    //bollMoy=(bollSup+bollInf)/2
    
    c1 = (bollSup < high[1])
    c2 = (bollInf > low[1])
    
    criteria = close
    
    SCREENER[c1 or c2] (criteria AS "Price")

     

    #6798 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Thank you very much.

Viewing 2 posts - 1 through 2 (of 2 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

Closed Bars with Low < Bollinger or High > Bollinger


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Henry @henry Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
10 years, 4 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 05/11/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...