PRT 11 Indicator disappears from screen when visually scrolling at barindex+1

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #152290 quote
    Daniele Maddaluno
    Participant
    Master

    I have written this indicator: VWAP@Time Z-score .
    Which I have published on PRC but it’s still not available at that precise moment (so meanwhile I post below the code):

    // VWAP@Time intraday Z-Score
    // 17.11.2020
    // Daniele Maddaluno
    //
    // startTime = 80000
    // endTime = 153000
    // smoothZscore = f
    // stdev = 2
     
    once posLev1=+stdev/2
    once negLev1=-stdev/2
    once posLev2=+stdev
    once negLev2=-stdev
     
    if opentime < startTime or opentime > endTime then
    	n = 0
    	zscoreT = 0
     
    	priced  = 0
    	shared  = 0
    	summ = 0
     
    	vwap = close
    	vwapstd = 0
    else
    	n = n + 1
    	// This if has been added just for plot reasons
    	if n <= 1 then
    		zscoreT = 0
    	else
    		zscoreT = 190
    	endif
     
    	priced = priced + (totalprice*volume)
    	shared = shared + volume
     
    	if shared>0 then
    		vwap = priced/shared
     
    		summ = summ + square(totalprice - vwap)
    		vwapstd = sqrt(summ / n)
    	endif
     
    endif
     
    if smoothZscore then
    	zscore = average[3]((close-vwap)/vwapstd)
    	else
    	zscore = (close-vwap)/vwapstd
    endif
     
    if zscore>=posLev2 then
    	drawcandle(posLev2, posLev2*1.25, posLev2, posLev2*1.25) coloured(255, 0, 0, 100) bordercolor(0, 0, 0, 0)
    endif
    if zscore<=negLev2 then
    	drawcandle(negLev2, negLev2*1.25, negLev2, negLev2*1.25) coloured(0, 255, 0, 100) bordercolor(0, 0, 0, 0)
    endif
     
    // Manage the coloring of vwap mid line
    if zscore > zscore[1] then
    	dwapR = 0
    	dwapG = 128
    	dwapB = 192
    else
    	dwapR = 255
    	dwapG = 0
    	dwapB = 0
    endif
     
    return zscore coloured(dwapR, dwapG, dwapB, zscoreT) style(line, 2) as "Z-score", posLev1 coloured(168, 168, 168) style(line, 2) as "Level +stdev/2", posLev2 coloured(210, 210, 210) style(line, 2) as "Level +stdev", negLev1 coloured(168, 168, 168) style(line, 2) as "Level -stdev/2", negLev2 coloured(210, 210, 210) style(line, 2) as "Level -stdev", 0 coloured(168, 168, 168) style(dottedline) as "Level 0"

    I have noticed that sometimes it has a strange behaviour that I didn’t had on PRT v10.
    Using this indicator, when horizontally scrolling at the barindex+1 bar (I mean the bar next the current one) the indicator completely disappears…
    Values in the “current” bar seems to be computed correctly…
    The main problem is that sometimes works, sometimes doesn’t, so I could not address any clear reason of the fault…
    I don’t think it’s linked to the indicator because I’m pretty sure that I have never had that problem on v10 (but I can be wrong)…

    I have attached a video to show what I meant.
    PRT v11.1 – 18.0_202 + IG (last update on 25 nov 2020)

    VWAP@Time-Z-score.mp4
    #152298 quote
    Nicolas
    Keymaster
    Master

    I can replicate the issue, I did not find a work around yet. Please send a technical report with a link of this thread and I will do the same.

    #152299 quote
    Nicolas
    Keymaster
    Master

    Seems that the problem is not present when using time based timeframe (1-minute and superior).

    EDIT: problem is the same with this code on classic timeframes too.

    #152314 quote
    Nicolas
    Keymaster
    Master

    Try to remove the DRAWCANDLE parts, seems related?!

    #152316 quote
    Daniele Maddaluno
    Participant
    Master

    I’ll try ASAP and let you know

    #152317 quote
    Daniele Maddaluno
    Participant
    Master

    Yeah, it seems linked to the fact that in some bars there is no candle to plot.
    In my specific case I solved adding this:

    if zscore<posLev2 and zscore>negLev2 then
        drawcandle(0, 0, 0, 0) coloured(0, 0, 0, 0) bordercolor(0, 0, 0, 0)
    endif

    So basically if I don’t want to plot a candle I plot it completely transparent (at 0,0,0,0 as ohlc)…
    It’s just a workaround and I think that it should be solved on the platform too.
    I’ll send a send a technical report as you suggested.
    Thank you!

    #153103 quote
    Nicolas
    Keymaster
    Master

    Problem is spotted and a fix is in the pipe! 🙂

    #153178 quote
    Daniele Maddaluno
    Participant
    Master

    Perfect! 🙂

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

PRT 11 Indicator disappears from screen when visually scrolling at barindex+1


ProBuilder: Indicators & Custom Tools

New Reply
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by Daniele Maddaluno
5 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/01/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...