how to compare a WHILE result

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #186333 quote
    ZeroCafeine
    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,

    #186483 quote
    robertogozzi
    Moderator
    Master

    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.

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 robertogozzi
4 years ago.

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