Draw an arrow on the minimum of the last n bars

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #170286 quote
    IcaroFM
    Participant
    Veteran

    How can I draw an arrow up on the minimum and an arrow down of the last n bars?

    For example: I would like to draw an arrow up and an arrow down of the last 10000 bars that shows the lower and the higher value. (see attached)

    PRTLowerHigherBar.png PRTLowerHigherBar.png
    #170293 quote
    robertogozzi
    Moderator
    Master

    There you go:

    Defparam DrawOnLastBarOnly = true
    ONCE hh = 0
    ONCE ll = 0
    p  = 10000
    n  = 0.003
    hh = highest[p](high)
    ll = lowest[p](low)
    IF (hh <> hh[1]) OR (ll <> ll[1]) THEN
       FOR i = 0 TO (p - 1)
          IF hh = high[i] THEN
             BarHH = BarIndex[i]
          ENDIF
          IF ll = low[i] THEN
             BarLL = BarIndex[i]
          ENDIF
       NEXT
    ENDIF
    DrawArrowUP(BarLL,ll * (1 - N))   coloured(0,255,0,255)
    DrawArrowDOWN(BarHH,hh * (1 + N)) coloured(255,0,0,255)
    RETURN

    but 10000 is such a high number that your chart will almost get stuck.

    IcaroFM thanked this post
    #170397 quote
    IcaroFM
    Participant
    Veteran

    Thank you very much Roberto

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

Draw an arrow on the minimum of the last n bars


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
IcaroFM @icarofm Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/24/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...