How to draw only the lastest signal

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #128748 quote
    mmichael
    Participant
    Average

    Hello,

    with following code, PRT shows all the occurences in the graph (a lot of dots).

    for better visibility, I only want to show the last signal (and not the previous ones). Is there a way to do that please?

    Thanks in advance.

    My code:

    doji = abs(open - close) <= (high - low) * 0.1
    
    IF doji THEN
    DRAWTEXT("•",barindex,low - 0.5,monospaced,standard,15) coloured(100,100,100,150)
    ENDIF
    
    return doji
    #128750 quote
    robertogozzi
    Moderator
    Master

    Add this line at the beginning, as line 1:

    DEFPARAM DrawOnLastBarOnly = True
    #128752 quote
    robertogozzi
    Moderator
    Master
    You have broken one of the rule of this forum:

    Do not double post. Ask your question only once and only in one forum. All double posts will be deleted anyway so posting the same question multiple times will just be wasting your own time and will not get you an answer any quicker. Double posting just creates confusion in the forums.

    You had first posted here, then you duplicated your topic in the French forum. This is not allowed as it would shatter info across multiple topics making it difficult to retrieve that info. I deleted the other one. Please read the basic rules, highlighted in yellow just above the SUBMIT button and stick to them. Thank you 🙂
    mmichael thanked this post
    #128753 quote
    mmichael
    Participant
    Average
    Hello Roberto, thanks a lot for your reactivity. I have not thaught things could be simple like that… This instruction can be very useful. I will test it. Sorry for the doublon, but it thaught my post was refused in the english forum. Thank you for deleting it to avoid any confusion.
    #128754 quote
    mmichael
    Participant
    Average
    Hello, The proposed solution does not work and no signal is shown. I guess because the last signal is not necessarily in the last bar. Any idea to help on this?  
    DEFPARAM DrawOnLastBarOnly = True
    
    doji = abs(open - close) <= (high - low) * 0.3
     
    IF doji THEN
    DRAWTEXT("•",barindex,low,monospaced,standard,20) coloured(230,230,230,200)
    DRAWTEXT("•",barindex,high + 0.5,monospaced,standard,20) coloured(230,230,230,200)
    ENDIF
     
    return doji
    #128755 quote
    mmichael
    Participant
    Average
    Here by my screenshot
    doji-signal.png doji-signal.png
    #128757 quote
    robertogozzi
    Moderator
    Master
    Yes, it’s because it only draws what is drawn on the last bar. Since DOJI occurred several bars before, it will not draw anything. To work it out, whenever a DOJI pattern occurs, it must save its BarIndex and the price levels where to plot it:
    DEFPARAM DrawOnLastBarOnly = True
    doji = abs(open - close) <= (high - low) * 0.3
    IF doji THEN
       DojiBar    = BarIndex
       DojiPrice1 =  low
       DojiPrice2 =  high + 0.5
    ENDIF
    DRAWTEXT("•",DojiBar,DojiPrice1,monospaced,standard,20) coloured(230,230,230,200)
    DRAWTEXT("•",DojiBar,DojiPrice2,monospaced,standard,20) coloured(230,230,230,200)
    return doji
    mmichael thanked this post
    x-27.jpg x-27.jpg
    #128809 quote
    mmichael
    Participant
    Average
    Hello Roberto, this works perfectly fine. Thanks for your precious help
    robertogozzi and wtangsiri thanked this post
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

How to draw only the lastest signal


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
mmichael @mmichael Participant
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by mmichael
5 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/29/2020
Status: Active
Attachments: 2 files
Logo Logo
Loading...