how to compare a WHILE result

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #186333 quote
    ZeroCafeineZeroCafeine
    Participant
    Senior

    hi everyone

    how to compare the last Count higher with the other Count higher ?

    MA50 = Average[50](close)
    DecreaseMA50 = MA50 < MA50[1]
    
    Count = 0
    
    WHILE DecreaseMA50[Count] DO
    Count = Count + 1
    WEND
    RETURN Count

    Best Reguards,

    last-count-of-while.png last-count-of-while.png
    #186483 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    You need to define a lookback period (say 50), to check the highest values witthin that range:
    Try this one:

    LookBack = 50
    MA50 = Average[50](close)
    DecreaseMA50 = MA50 < MA50[1]
     
    Count = 0
     
    WHILE DecreaseMA50[Count] DO
       Count = Count + 1
    WEND
    IF (BarIndex mod LookBack) = 0 THEN
       HH = highest[LookBack](Count)
    ENDIF
    
    RETURN HH as "HH",Count AS"Count"
    ZeroCafeine thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

how to compare a WHILE result


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
4 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/22/2022
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...