Nadaraya Watson Screener

Forums ProRealTime English forum ProScreener support Nadaraya Watson Screener

Viewing 5 posts - 1 through 5 (of 5 total)
  • #203340

    Hello,

    I have this code below for Nadaraya Watson Indicator, I would like to make a Screener out of it. I want price  to be below 200 SMA and price (high) to touch the Nadaraya top(high). Please see below:

    Could you please  help me with how to translate it into screener? Thank you.

    code for Nadaraya Watson is:

    //Nadaraya-Watson Envelope
    defparam drawonlastbaronly = true
    length = Min(500,BarIndex)
    hh = 8 //Bandwidth
    mult = .3
    src = Close
    n = barindex
    k = 2
    if IsLastBarUpdate then
    y2 = 0
    sume = 0
    for i = 0 to length-1
    sum = 0
    sumw = 0

    for j = 0 to length-1
    w = EXP(-pow(i-j,2)/(hh*hh*2))
    sum = sum+src[j]*w
    sumw = sumw+w
    next
    y2 = sum/sumw
    sume = sume+abs(src[i] – y2)
    $a[barindex-i]=y2
    //DRAWPOINT(barindex-i, y2, 1)

    next
    mae = sume/(length*mult)
    for i=0 to length-1

    DRAWPOINT(barindex-i, $a[barindex-i]-mae, 2) coloured(0,255,0,100)
    DRAWPOINT(barindex-i, $a[barindex-i]+mae, 2) coloured(255,0,0,100)
    //if close[barindex-i] > ($a[barindex-i]+mae) then // and src[1]<y2[1]+mae then
    //drawarrowdown(barindex-i,high) coloured(“red”)
    //endif
    //if close[barindex-i] < ($a[barindex-i]-mae) then //and src[1]>y2[1]-mae then
    //drawarrowup(barindex-i,low) coloured(“green”)
    //endif
    next

    /*drawpoint(barindex,y2,1)
    drawpoint(barindex,y2+mae,1)
    drawpoint(barindex,y2-mae,1)*/

    Y2High=$a[barindex]+mae
    Y2Low=$a[barindex]-mae

    endif
    return y2,y2+mae,y2-mae

     

    #203461
    JS

    The “pow” function does not seem to work in a screener…

    Screenshot with conditions…

    #203466

    POW can be replaced by y = EXP(p*LOG(x)) .

     

    #203564

    Any idea how to convert Nadaraya indicator into Screener?

    Thank you.

    #233463

    If you replace

     

    w = EXP(-pow(i-j,2)/(hh*hh*2))

    with

    w= exp(-((i – j)*(i-j)) / (2 * hh*hh))

    it should work

    I appreciate this is 2 years down the line but I came across the same issue – so you may well have got your solution a while ago.

    Steve

Viewing 5 posts - 1 through 5 (of 5 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login