Screener Nadaraya Watson Envelope

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #243351 quote
    Azkune
    Participant
    New

    Hola,

    Gracias a Iván pudimos tener el indicador traducido desde Trading View. Ahora me gustaría, poder conseguir un screener que me muestre las empresas que tienen la flecha verde para arriba y las flechas rojas, para abajo.

    Creo que sería algo interesante, para tenerlo.

    El indicador es el siguiente, no sé cómo puedo hacer el screener para conseguir lo mencionado anteriormente.

    Gracias de antemano,

    Un saludo

    //——————————————–//
    //PRC Nadaraya-Watson Envelope
    //version = 0
    //28.02.24
    //Iván González @ http://www.prorealcode.com
    //Sharing ProRealTime knowledge
    //——————————————–//
    //———–Inputs—————————//
    //——————————————–//
    h1=8 //Bandwidth
    mult=3
    length=499 //Window Size
    repaint=1
    src=close
    //——————————————–//
    //———-Repaint ON————————//
    //——————————————–//
    if islastbarupdate and repaint then
    sae=0
    for i=0 to min(499,barindex-1) do
    sum=0
    sumw=0
    for j=0 to min(499,barindex-1) do
    x=i-j
    w=exp(-(pow(x,2)/(h1*h1*2)))
    sum=src[j]*w+sum
    sumw=w+sumw
    next
    $y2[i]=sum/sumw
    sae=sae+abs(src[i]-$y2[i])
    next

    sae1=sae/min(499,barindex-1)*mult

    for i=min(499,barindex-1) downto 0 do
    if i MOD 2 <> 0 then
    drawpoint(barindex[i],$y2[i]+sae1,2)coloured(“green”)
    drawpoint(barindex[i],$y2[i]-sae1,2)coloured(“red”)
    endif
    if close[i]>$y2[i]+sae1 and close[i+1]<=$y2[i+1]+sae1 then
    drawarrowdown(barindex[i],high[i])coloured(“red”)
    elsif close[i]<$y2[i]-sae1 and close[i+1]>=$y2[i+1]-sae1 then
    drawarrowup(barindex[i],low[i])coloured(“green”)
    endif
    next
    endif
    //——————————————–//
    //———-Repaint OFF———————–//
    //——————————————–//
    if repaint=0 then
    once init = 1

    If init = 1 then
    den = 0
    For i = 0 to length-1 do
    $coefs[i]=exp(-(i*i)/(h1*h1*2))
    den = den + $coefs[i]
    Next
    init = 0
    Endif

    out = 0

    For i = 0 to length-1 do
    out = out + src[i]*$coefs[i]
    Next

    out = out/den
    mae = exponentialAverage[length](abs(src-out)) * mult

    upper = out + mae
    lower = out – mae

    if close crosses over upper then
    drawarrowdown(barindex,high)coloured(“red”)
    elsif close crosses under lower then
    drawarrowup(barindex,low)coloured(“green”)
    endif
    endif
    //——————————————–//
    //———-Plot Bands————————//
    //——————————————–//
    if repaint then
    up=undefined
    dw=undefined
    else
    up=upper
    dw=lower
    endif
    //——————————————–//
    return up as “Upper band”style(line,2)coloured(“Green”),dw as “Lower band”style(line,2)coloured(“red”)

    #243362 quote
    Iván González
    Moderator
    Master

    Hola!
    Aquí lo tienes (+1 flecha verde / -1 flecha roja):

    //--------------------------------------------//
    //PRC Nadaraya-Watson Envelope
    //version = 0
    //28.02.24
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //--------------------------------------------//
    //-----------Inputs---------------------------//
    //--------------------------------------------//
    h1=8 //Bandwidth
    mult=3
    length=499 //Window Size
    //repaint=1
    src=close
    //--------------------------------------------//
    //----------Repaint OFF-----------------------//
    //--------------------------------------------//
    
    once init = 1
    
    If init = 1 then
    den = 0
    For i = 0 to length-1 do
    $coefs[i]=exp(-(i*i)/(h1*h1*2))
    den = den + $coefs[i]
    Next
    init = 0
    Endif
    
    out = 0
    
    For i = 0 to length-1 do
    out = out + src[i]*$coefs[i]
    Next
    
    out = out/den
    mae = exponentialAverage[length](abs(src-out)) * mult
    
    upper = out + mae
    lower = out - mae
    
    if close crosses over upper then
    setup=-1
    elsif close crosses under lower then
    setup=1
    else
    setup=0
    endif
    screener[setup<>0](setup as "Setup")
    
    #243434 quote
    Azkune
    Participant
    New

    Hola,

    Me pone lo siguiente al ejecutar: Este ProScreener no puede ejecutarse: una de las instrucciones contiene un offset negativo o de un valor excesivo (p.ej:low[-1] o low[300].

    Los valores de offset han de ser números enteros entre 0 y 254.

    Gracias de antemano,

    Un saludo

    #243437 quote
    Iván González
    Moderator
    Master

    Hola. Imagino que es por la variable length.
    Si no tienes cuenta premium tendrás que bajar el valor length y que sea inferior a 254.

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

Screener Nadaraya Watson Envelope


ProScreener: Buscadores de Mercado y Rastreo

New Reply
Author
author-avatar
Azkune @azkune Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Iván González
1 year ago.

Topic Details
Forum: ProScreener: Buscadores de Mercado y Rastreo
Language: Spanish
Started: 02/02/2025
Status: Active
Attachments: No files
Logo Logo
Loading...