MTF screener for Price action – issue

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #141040 quote
    AbzAbz
    Participant
    Veteran

    Hello

    made a MTF screener based on the price action indicator found here https://www.prorealcode.com/prorealtime-indicators/weighted-price-action/ however it dosent seems to give the correct screener results.

    result can be 1 = uptrend on 1h timeframe however if i go to chart i can see it is acutally 2 = downtrend

     

    thanks to @robertogozzi for making this template

     

    // 1 = ↑
    // 2 = ↓
    // 9 = no signal on that TF
    //
    // 4 = 4-hour TF
    // H = 1-hour TF
    // 1 = 15-minute TF
    // 5 = 5-minute TF
    //
    TIMEFRAME(daily)
    p=20
    closeopen = 1
    highhigh = 1
    lowlow = 1
    closeinrange = 1
    Averages = 1
    lines = 1
    
    a = (close > open)
    b = (high > high[1])
    c = (low > low[1])
    d = ((close-low)/(high-low) > 0.5)
    
    e = (close < open)
    f = (high < high[1])
    g = (low < low[1])
    i = ((close-low)/(high-low) < 0.5)
    
    up = 0
    down = 0
    
    for j = 0 to p-1
    if closeopen then
    if a[j] then
    up = up + (p-j)
    endif
    if e[j] then
    down = down + (p-j)
    endif
    endif
    
    if highhigh then
    if b[j] then
    up = up + (p-j)
    endif
    if f[j] then
    down = down + (p-j)
    endif
    endif
    
    
    if lowlow then
    if c[j] then
    up = up + (p-j)
    endif
    if g[j] then
    down = down + (p-j)
    endif
    endif
    
    if closeinrange then
    if d[j] then
    up = up + (p-j)
    endif
    if i[j] then
    down = down + (p-j)
    endif
    endif
    next
    
    upres = (up - min(up,down))
    downres = (down - min(up,down))
    upave = weightedaverage[p/2](upres)
    downave = weightedaverage[p/2](downres)
    
    if averages then
    upave = upave
    downave = downave
    else
    upave = undefined
    downave = undefined
    endif
    
    if lines then
    upres2 = upres
    downres2 = downres
    else
    upres2 = undefined
    downres2 = undefined
    endif
    
    //return upres2 coloured(0,128,0) as "long", downres2 coloured(128,0,0) as "short", upave coloured(0,128,0) as "long average", downave coloured(128,0,0) as "short average"
    
    XSignal= 9000
    IF upres2 > downres2 and upave > downave  THEN
    XSignal = 1000
    ELSIF upres2 < downres2 and upave < downave THEN
    XSignal = 2000
    ENDIF
    
    TIMEFRAME(4 hour)
    yp=20
    ycloseopen = 1
    yhighhigh = 1
    ylowlow = 1
    ycloseinrange = 1
    yAverages = 1
    ylines = 1
    
    ya = (close > open)
    yb = (high > high[1])
    yc = (low > low[1])
    yd = ((close-low)/(high-low) > 0.5)
    
    ye = (close < open)
    yf = (high < high[1])
    yg = (low < low[1])
    yi = ((close-low)/(high-low) < 0.5)
    
    yup = 0
    ydown = 0
    
    for yj = 0 to yp-1
    if ycloseopen then
    if ya[yj] then
    yup = yup + (yp-yj)
    endif
    if ye[yj] then
    ydown = ydown + (yp-j)
    endif
    endif
    
    if yhighhigh then
    if yb[yj] then
    yup = yup + (yp-yj)
    endif
    if yf[yj] then
    ydown = ydown + (yp-yj)
    endif
    endif
    
    
    if ylowlow then
    if yc[yj] then
    yup = yup + (yp-yj)
    endif
    if yg[yj] then
    ydown = ydown + (yp-yj)
    endif
    endif
    
    if ycloseinrange then
    if yd[yj] then
    yup = yup + (yp-yj)
    endif
    if yi[yj] then
    ydown = ydown + (yp-yj)
    endif
    endif
    next
    
    yupres = (yup - min(yup,ydown))
    ydownres = (ydown - min(yup,ydown))
    yupave = weightedaverage[yp/2](yupres)
    ydownave = weightedaverage[yp/2](ydownres)
    
    if yaverages then
    yupave = yupave
    ydownave = ydownave
    else
    yupave = undefined
    ydownave = undefined
    endif
    
    if ylines then
    yupres2 = yupres
    ydownres2 = ydownres
    else
    yupres2 = undefined
    ydownres2 = undefined
    endif
    
    
    YSignal= 900
    IF yupres2 > ydownres2 and yupave > ydownave THEN
    YSignal = 100
    ELSIF yupres2 < ydownres2 and yupave < ydownave THEN
    YSignal = 200
    ENDIF
    //
    TIMEFRAME(1 hour)
    zp=20
    zcloseopen = 1
    zhighhigh = 1
    zlowlow = 1
    zcloseinrange = 1
    zAverages = 1
    zlines = 1
    
    za = (close > open)
    zb = (high > high[1])
    zc = (low > low[1])
    zd = ((close-low)/(high-low) > 0.5)
    
    ze = (close < open)
    zf = (high < high[1])
    zg = (low < low[1])
    zi = ((close-low)/(high-low) < 0.5)
    
    zup = 0
    zdown = 0
    
    for zj = 0 to zp-1
    if zcloseopen then
    if za[zj] then
    zup = zup + (zp-zj)
    endif
    if ze[zj] then
    zdown = zdown + (zp-j)
    endif
    endif
    
    if zhighhigh then
    if zb[zj] then
    zup = zup + (zp-zj)
    endif
    if zf[zj] then
    zdown = zdown + (zp-zj)
    endif
    endif
    
    
    if zlowlow then
    if zc[zj] then
    zup = zup + (zp-zj)
    endif
    if zg[zj] then
    zdown = zdown + (zp-zj)
    endif
    endif
    
    if zcloseinrange then
    if zd[zj] then
    zup = zup + (zp-zj)
    endif
    if zi[zj] then
    zdown = zdown + (zp-zj)
    endif
    endif
    next
    
    zupres = (zup - min(zup,zdown))
    zdownres = (zdown - min(zup,zdown))
    zupave = weightedaverage[zp/2](zupres)
    zdownave = weightedaverage[zp/2](zdownres)
    
    if zaverages then
    zupave = zupave
    zdownave = zdownave
    else
    zupave = undefined
    zdownave = undefined
    endif
    
    if zlines then
    zupres2 = zupres
    zdownres2 = zdownres
    else
    zupres2 = undefined
    zdownres2 = undefined
    endif
    
    
    ZSignal= 90
    IF zupres2 > zdownres2 and zupave > zdownave THEN
    ZSignal = 10
    ELSIF zupres2 < zdownres2 and zupave < zdownave THEN
    ZSignal = 20
    ENDIF
    //
    TIMEFRAME(15 minute)
    wp=20
    wcloseopen = 1
    whighhigh = 1
    wlowlow = 1
    wcloseinrange = 1
    wAverages = 1
    wlines = 1
    
    wa = (close > open)
    wb = (high > high[1])
    wc = (low > low[1])
    wd = ((close-low)/(high-low) > 0.5)
    
    we = (close < open)
    wf = (high < high[1])
    wg = (low < low[1])
    wi = ((close-low)/(high-low) < 0.5)
    
    wup = 0
    wdown = 0
    
    for wj = 0 to wp-1
    if wcloseopen then
    if wa[wj] then
    wup = wup + (wp-wj)
    endif
    if we[wj] then
    wdown = wdown + (wp-j)
    endif
    endif
    
    if whighhigh then
    if wb[wj] then
    wup = wup + (wp-wj)
    endif
    if wf[wj] then
    wdown = wdown + (wp-wj)
    endif
    endif
    
    
    if wlowlow then
    if wc[wj] then
    wup = wup + (wp-wj)
    endif
    if wg[wj] then
    wdown = wdown + (wp-wj)
    endif
    endif
    
    if wcloseinrange then
    if wd[wj] then
    wup = wup + (wp-wj)
    endif
    if wi[wj] then
    wdown = wdown + (wp-wj)
    endif
    endif
    next
    
    wupres = (wup - min(wup,wdown))
    wdownres = (wdown - min(wup,wdown))
    wupave = weightedaverage[wp/2](wupres)
    wdownave = weightedaverage[wp/2](wdownres)
    
    if waverages then
    wupave = wupave
    wdownave = wdownave
    else
    wupave = undefined
    wdownave = undefined
    endif
    
    if wlines then
    wupres2 = wupres
    wdownres2 = wdownres
    else
    wupres2 = undefined
    wdownres2 = undefined
    endif
    
    wSignal= 9
    IF wupres2 > wdownres2 and wupave > wdownave THEN
    wSignal = 1
    ELSIF wupres2 < wdownres2 and wupave < wdownave THEN
    wSignal = 2
    ENDIF
    //
    TIMEFRAME(default)
    Signal =  XSignal + YSignal + ZSignal + WSignal
    IF Signal = 9999 THEN
    Signal = 0
    ENDIF
    SCREENER[Signal](Signal AS "1=↑,2=↓/D4H5")
    
    #141048 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Line 129 should read:

    ydown = ydown + (yp-yj)

    The same for lines 219 and 309 with a different letter prior to j.

    Abz thanked this post
    #141050 quote
    AbzAbz
    Participant
    Veteran

    Thanks for observation , i found one in line 129 as well 🙂

    #141056 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Me too.

    #141057 quote
    AbzAbz
    Participant
    Veteran

    Yes i was a little bit fast there 🙂

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

MTF screener for Price action – issue


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Abz @abbas_sadiq Participant
Summary

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

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 08/07/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...