Issue with fill and text labels when plotting daily EMA zone on a 5-minute chart

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #253832 quote
    Tito Peronni
    Participant
    New

    Hi,

    I’m trying to draw/plot a zone between two daily-timeframe values on a 5-minute chart. In general, everything seems to work except for the last candle, where the fill function produces a noticeable spike.

    Additionally, the text labels do not appear; when I don’t use the timeframe function, they show up on the right side as expected (see cursor information, it seems to be correct floats).

    defparam drawonlastbaronly=true
    
    // 1 DAY (1D)
    TIMEFRAME(1 DAY)
    
    dema1 = DEMA[1](close)
    dema2 = DEMA[2](close)
    
    DRAWTEXT(" dema 1", BarIndex, dema1, Dialog, Bold, 12) COLOURED(1,1,1)
    DRAWTEXT(" dema 2", BarIndex, dema2, Dialog, Bold, 12) COLOURED(1,1,1)
    
    colorbetween(dema1, dema2, 1,1,1, 50)
    
    return dema1 coloured(1,1,1) style(line,1) as "dema 1", dema2 coloured(1,1,1) style(dottedline,2) as "dema 2"
    PRC_Issue_plot.jpg PRC_Issue_plot.jpg
    #253854 quote
    Iván González
    Moderator
    Master
    Hi! The issues you are encountering are due to how Multi-Timeframe (MTF) instructions handle the BarIndex and the data aggregation. To hide the visual artifact on the forming candle you coudl manipulate transparency. try this:
    defparam drawonlastbaronly=true
    
    TIMEFRAME(daily,updateonclose)
    
    dema1 = DEMA[1](close)
    dema2 = DEMA[2](close)
    
    once alpha=50
    
    if islastbarupdate then
       alpha=0
    endif
    
    timeframe(default)
    
    DRAWTEXT(" dema 1", BarIndex, dema1, Dialog, Bold, 12) COLOURED(1,1,1)
    DRAWTEXT(" dema 2", BarIndex, dema2, Dialog, Bold, 12) COLOURED(1,1,1)
    
    colorbetween(dema1, dema2, 1,1,1, alpha)
    
    return dema1 coloured(1,1,1) style(line,1) as "dema 1", dema2 coloured(1,1,1) style(dottedline,2) as "dema 2"
    robertogozzi and Tito Peronni thanked this post
    #253869 quote
    Tito Peronni
    Participant
    New
    Thank you very much for all your help! What I was able to verify (by printing the value of the last candle) was that the value of dema2 was N/A. However, the lines can be drawn and dema1 is allways defined. Why does the function work fine on the first calculation but not on all subsequent ones?
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Issue with fill and text labels when plotting daily EMA zone on a 5-minute chart


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Tito Peronni
3 months, 1 week ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/20/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...