Range Filter Buy and Sell Screener

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #265456 quote
    finplusfinplus
    Participant
    Master

    Bonjour,

    à partir du code ci-dessous, j’ai demandé à l’IA du site de me le transformer en screener permettant d’identifier les actifs lorsqu’ils le “ruban” est bleu ou rouge.


    // Original Script > @DonovanWall

    // Adapted Version > @guikroth

     

    //////////////////////////////////////////////////////////////////////////

    // Settings for 5min chart, BTCUSDC. For Other coin, change the parameters

    //////////////////////////////////////////////////////////////////////////


    DefParam DrawOnLastBarOnly = true

    xClose = (Open+High+Low+Close)/4

    // Source

    src = xclose

    // Sampling Period

    // Settings for 5min chart, BTCUSDC. For Other coin, change the paremeters

    // per = defval=100, minval=1, “Sampling Period”

    // Range Multiplier

    // mult = defval=3.0, minval=0.1, “Range Multiplier”

    PER = 100

    MULT = 3

    // Smooth Average Range

    wper = per*2 -1

    avrng = exponentialaverage[per](abs(src-src[1]))

    smrng = mult * exponentialaverage[wper](avrng)

     

    // Range Filter

    rngfilt = src

    If src > rngfilt[1] then

    If rngfilt[1] > src-smrng then

    rngfilt = rngfilt[1]

    Else

    rngfilt = src-smrng

    endif

    elsif rngfilt[1] < src+smrng then

    rngfilt = rngfilt[1]

    else

    rngfilt = src+smrng

    endif

    filt = rngfilt

     

    // Filter Direction

    upward = 0

    If filt > filt[1] then

    upward = upward[1]+1

    elsif filt < filt[1] then

    upward = 0

    else

    upward = upward[1]

    endif

    downward = 0

    If filt < filt[1] then

    downward = downward[1]+1

    elsif filt > filt[1] then

    downward = 0

    else

    downward = downward[1]

    endif

     

    // Target Bands

    hband = filt + smrng

    lband = filt – smrng

     

     

    //// Zone de couleurs : selon des conditions

    ////////////////////////////////////////////////////////////////////////////

     

    mbTendance = (Average[3](filt) + filt)/2

    if mbTendance > mbTendance[1] then

    red=0

    green=0

    blue=255

    elsif mbTendance < mbTendance[1] then

    red=255

    green=0

    blue=0

    endif


    colorbetween(lband,hband,red,Green,Blue,88)


    if islastbarupdate then

    if close<hband then

    DRAWSEGMENT(barindex, hband, barindex+5, hband)style(line,2) coloured(0,0,200)

    endif

    if close>lband then

    DRAWSEGMENT(barindex, lband, barindex+5, lband)style(line,2) coloured(0,0,200)

    endif

    endif



    Le screener ci-dessous réalisé par l’IA du site ne renvoie aucune valeur. Pourriez-vous voir ce qui ne va pas ?

    Merci.


    xCloseW = (Open+High+Low+Close)/4
    
    // Source
    srcW = xcloseW
    PERW = 100
    MULTW = 3
    
    // Smooth Average Range
    wperW = perW*2 -1
    avrngW = exponentialaverage[perW](abs(srcW-srcW[1]))
    smrngW = multW * exponentialaverage[wperW](avrngW)
    
    // Range Filter
    rngfiltW = srcW
    If srcW > rngfiltW[1] then
    If rngfiltW[1] > srcW-smrngW then
    rngfiltW = rngfiltW[1]
    Else
    rngfiltW = srcW-smrngW
    endif
    
    elsif rngfiltW[1] < srcW+smrngW then
    rngfiltW = rngfiltW[1]
    else
    rngfiltW = srcW+smrngW
    
    endif
    filtW = rngfiltW
    
    // Filter Direction
    upwardW = 0
    
    If filtW > filtW[1] then
    upwardW = upwardW[1]+1
    elsif filtW < filtW[1] then
    upwardW = 0
    else
    upwardW = upwardW[1]
    endif
    
    downwardW = 0
    
    If filtW < filtW[1] then
    downwardW = downwardW[1]+1
    elsif filtW > filtW[1] then
    downwardW = 0
    else
    downwardW = downwardW[1]
    endif
    
    // Zone de couleurs
    mbTendanceW = (Average[3](filtW) + filtW)/2
    if mbTendanceW > mbTendanceW[1] then
    redW=0
    blueW=255
    elsif mbTendanceW < mbTendanceW[1] then
    redW=255
    blueW=0
    endif
    
    longConditionW = blueW>0
    shortConditionW = redW>0
    
    SCREENER[longConditionW OR shortConditionW](longConditionW AS "Long", shortConditionW AS "Short")
    


    #265457 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Voici le code du screener ; j’ai toutefois dû modifier les périodes de la moyenne mobile exponentielle (EMA), car la limite est fixée à 254 et l’EMA nécessite bien plus du double des périodes indiquées pour ses calculs internes. Je l’ai donc ramenée à 50 (une valeur de 70 pourrait aussi convenir ; fais quelques essais).

    Si tu as absolument besoin de 100 périodes, tu dois utiliser une moyenne mobile simple (SMA).

    // Original Script > @DonovanWall
    // Adapted Version > @guikroth
    //////////////////////////////////////////////////////////////////////////
    // Settings for 5min chart, BTCUSDC. For Other coin, change the parameters
    //////////////////////////////////////////////////////////////////////////
    //DefParam DrawOnLastBarOnly = true
    IF BARiNDEX = 0 then
    Signal = 0
    endif
    
    
    xClose = (Open+High+Low+Close)/4
    // Source
    src = xclose
    // Sampling Period
    // Settings for 5min chart, BTCUSDC. For Other coin, change the paremeters
    // per = defval=100, minval=1, "Sampling Period"
    // Range Multiplier
    // mult = defval=3.0, minval=0.1, "Range Multiplier"
    PER = 50
    MULT = 3
    // Smooth Average Range
    wper = per*2 -1
    avrng = exponentialaverage[per](abs(src-src[1]))
    smrng = mult * exponentialaverage[wper](avrng)
    // Range Filter
    rngfilt = src
    If src > rngfilt[1] then
    If rngfilt[1] > src-smrng then
    rngfilt = rngfilt[1]
    Else
    rngfilt = src-smrng
    endif
    elsif rngfilt[1] < src+smrng then
    rngfilt = rngfilt[1]
    else
    rngfilt = src+smrng
    endif
    filt = rngfilt
    // Filter Direction
    upward = 0
    If filt > filt[1] then
    upward = upward[1]+1
    elsif filt < filt[1] then
    upward = 0
    else
    upward = upward[1]
    endif
    downward = 0
    If filt < filt[1] then
    downward = downward[1]+1
    elsif filt > filt[1] then
    downward = 0
    else
    downward = downward[1]
    endif
    // Target Bands
    //hband = filt + smrng
    //lband = filt - smrng
    //// Zone de couleurs : selon des conditions
    ////////////////////////////////////////////////////////////////////////////
    mbTendance = (Average[3](filt) + filt)/2
    if mbTendance > mbTendance[1] then
    Signal = 1
    //red=0
    //green=0
    //blue=255
    elsif mbTendance < mbTendance[1] then
    Signal = 2
    //red=255
    //green=0
    //blue=0
    endif
    //colorbetween(lband,hband,red,Green,Blue,88)
    //if islastbarupdate then
    //if close<hband then
    //DRAWSEGMENT(barindex, hband, barindex+5, hband)style(line,2) coloured(0,0,200)
    //endif
    //if close>lband then
    //DRAWSEGMENT(barindex, lband, barindex+5, lband)style(line,2) coloured(0,0,200)
    //endif
    //endif
    screener[Signal](Signal AS "1=Up,2=Red")
    

    Le signal renvoyé est 1 lorsque le ruban est bleu, 2 lorsqu’il est rouge.




    #265459 quote
    finplusfinplus
    Participant
    Master

    Merci. Je vais tester.

    Bonne soirée.

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

Range Filter Buy and Sell Screener


ProScreener : Scanners de Marché & Détection

New Reply
Author
author-avatar
finplus @finplus Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by finplusfinplus
3 hours ago.

Topic Details
Forum: ProScreener : Scanners de Marché & Détection
Language: French
Started: 10/03/2026
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...