BBands Stop indicator convert into a screener

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #84095 quote
    Willy
    Participant
    Average

    Hello,

    Can someone help me to convert the indicator “BBands Stop” into a screener. I am not very familiar with the programming code.

    //PRC_BBands Stop | indicator
    //30.03.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //translated from MT4 code
     
    // --- settings
    //Length=20      // Bollinger Bands Period
    //Deviation=2    // Deviation
    //MoneyRisk=1.00 // Offset Factor
    // --- end of settings
     
    avg=average[Length]
    dev=std[Length]*Deviation
    smax = avg+dev
    smin = avg-dev
     
    if close>smax[1] then
     trend=1
    endif
    if close<smin[1] then
     trend=-1
    endif
     
    if trend>0 and smin<smin[1] then
     smin=smin[1]
    endif
    if trend<0 and smax>smax[1] then
     smax=smax[1]
    endif
     
    bsmax=smax+0.5*(MoneyRisk-1)*(smax-smin)
    bsmin=smin-0.5*(MoneyRisk-1)*(smax-smin)
     
    if(trend>0 and bsmin<bsmin[1]) then
     bsmin=bsmin[1]
    endif
    if(trend<0 and bsmax>bsmax[1]) then
     bsmax=bsmax[1]
    endif
     
    if trend>0 then
     TrendLine=bsmin
     r=127 
     g=255
     drawtext("•",barindex,bsmin,Dialog,Standard,10) coloured(r,g,0)
     if trend[1]<0 then
      drawtext("•",barindex,bsmin,Dialog,Standard,22) coloured(r,g,0)
     endif
    endif
     
    if trend<0 then
     TrendLine=bsmax
     r=255 
     g=165
     drawtext("•",barindex,bsmax,Dialog,Standard,10) coloured(r,g,0)
     if trend[1]>0 then
      drawtext("•",barindex,bsmax,Dialog,Standard,22) coloured(r,g,0)
     endif
    endif
     
    RETURN TrendLine coloured(r,g,0) style(line,2) as "BBands stop Trend"

    Thank you

    #84116 quote
    Nicolas
    Keymaster
    Legend

    Please find below the code of the screener that detects the trend change with the BBands Stop indicator:

    //PRC_BBands Stop screener | screener
    //04.11.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
     
    // --- settings
    Length=20      // Bollinger Bands Period
    Deviation=2    // Deviation
    MoneyRisk=1.00 // Offset Factor
    // --- end of settings
     
    avg=average[Length]
    dev=std[Length]*Deviation
    smax = avg+dev
    smin = avg-dev
     
    if close>smax[1] then
    trend=1
    endif
    if close<smin[1] then
    trend=-1
    endif
     
    if trend>0 and smin<smin[1] then
    smin=smin[1]
    endif
    if trend<0 and smax>smax[1] then
    smax=smax[1]
    endif
     
    bsmax=smax+0.5*(MoneyRisk-1)*(smax-smin)
    bsmin=smin-0.5*(MoneyRisk-1)*(smax-smin)
     
    if(trend>0 and bsmin<bsmin[1]) then
    bsmin=bsmin[1]
    endif
    if(trend<0 and bsmax>bsmax[1]) then
    bsmax=bsmax[1]
    endif
     
    test = trend<>trend[1]
    
    screener[test]
    #84122 quote
    Willy
    Participant
    Average

    Bonjour Nicolas,

    Merci beaucoup, tout fonctionne parfaitement.

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

BBands Stop indicator convert into a screener


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Willy @ws Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Willy
7 years, 10 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 11/03/2018
Status: Active
Attachments: No files
Logo Logo
Loading...