HIghest High since crossing an MA

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #132327 quote
    bbgg91
    Participant
    New

    Does anyone have a suggestion on how to code the highest high or lowest low since crossing an MA and marking that bar on the screen? Thanks!

    #132337 quote
    robertogozzi
    Moderator
    Master

    Not tested:

    Once MyHigh = 0
    Once MyLow  = 0
    CrossOver      = close crosses over average[200,0](close)
    CrossUnder     = close crosses under average[200,0](close)
    If CrossOver or CrossUnder Then
       MyHigh = high
       MyLow  = low
       drawtext("●",barindex,high+15*pipsize,Dialog,Bold,10) coloured(255,0,0,255)
    Endif
    MyHigh = max(MyHigh,high)
    MyLow  = min(MyLow,low)
    Return MyHigh as “HI”,MyLow as “LO”
    bbgg91 thanked this post
    #132343 quote
    bbgg91
    Participant
    New

    Many thanks for the code and it works somewhat. What I am trying to do is plot something above the highest high between two crossings. For example, we cross above an MA, stay above for a while, then cross below. I am trying to mark the highest high in that time interval.

    #132357 quote
    robertogozzi
    Moderator
    Master

    Make an example, possibly attaching a screenshot of what you want to see.

    #132364 quote
    bbgg91
    Participant
    New

    I hope this make sense. Thanks for the help.

    example.jpg example.jpg
    #132392 quote
    robertogozzi
    Moderator
    Master

    (not tested):

    Once MyHigh = 0
    Once MyLow  = 0
    CrossOver   = close crosses over average[200,0](close)
    CrossUnder  = close crosses under average[200,0](close)
    If CrossOver or CrossUnder Then
       MyHigh = high
       MyLow  = low
    Endif
    MyHigh = max(MyHigh,high)
    MyLow  = min(MyLow,low)
    IF MyHigh <> MyHigh[1] THEN
       DrawArrowDown(BarIndex,high + 10 * pipsize) coloured(0,128,0,255)
    ENDIF
    IF MyLow <> MyLow[1] THEN
       DrawArrowUP(BarIndex,high + 10 * pipsize) coloured(255,0,0,255)
    ENDIF
    Return
    bbgg91 thanked this post
    #132403 quote
    bbgg91
    Participant
    New

    Many thanks. It has put me on the right track.

    example-1.jpg example-1.jpg
    #132408 quote
    robertogozzi
    Moderator
    Master

    Do you need text on crossings, as well?

    #132495 quote
    bbgg91
    Participant
    New

    No that is ok. It seems ProRealTime just does the processing on the last bar so as the bars develop it leaves the arrows behind it. It would be good if the previous arrows could be erased. Currently I am writing over them with white.

    #132512 quote
    robertogozzi
    Moderator
    Master

    There you go:

    Defparam DrawOnLastBarOnly = true
    Once MyHigh = 0
    Once MyLow  = 0
    CrossOver   = close crosses over average[200,0](close)
    CrossUnder  = close crosses under average[200,0](close)
    If CrossOver or CrossUnder Then
       MyHigh = high
       MyLow  = low
    Endif
    MyHigh = max(MyHigh,high)
    MyLow  = min(MyLow,low)
    IF MyHigh <> MyHigh[1] THEN
      HiBar = BarIndex
    ENDIF
    IF MyLow <> MyLow[1] THEN
      LoBar = BarIndex
    ENDIF
    DrawArrowDown(HiBar,MyHigh + 10 * pipsize) coloured(0,128,0,255)
    DrawArrowUP(LoBar,MyLow - 10 * pipsize) coloured(255,0,0,255)
    Return
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.

HIghest High since crossing an MA


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
bbgg91 @bbgg91 Participant
Summary

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

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