Nadaraya Watson Screener

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #203340 quote
    MaryMary
    Participant
    Average

    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

    NADARAYA-SCREENER.png NADARAYA-SCREENER.png
    #203461 quote
    JSJS
    Participant
    Master

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

    Screenshot with conditions…

    Scherm­afbeelding-2022-11-03-om-06.47.04.png Scherm­afbeelding-2022-11-03-om-06.47.04.png
    #203466 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    POW can be replaced by y = EXP(p*LOG(x)) .
    #203564 quote
    MaryMary
    Participant
    Average
    Any idea how to convert Nadaraya indicator into Screener? Thank you.
    #233463 quote
    hombrehombre
    Participant
    Junior
    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)
  • 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

Nadaraya Watson Screener


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Mary @mila Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by hombrehombre
2 years, 3 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 11/01/2022
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...