Testing a condition on a defined number of bars

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #138379 quote
    Albert Kader
    Participant
    New

    Hi,

     

    I cannot figure out how to test if a condition is true in a predefined period or a number of bars. I have been trying to use barIndex with little luck. Can someone please offer some guidance? thank you.

    I’d like to write a code like this:

    IF condition[period] THEN
    
       do_someting
    
    ENDIF
    #138385 quote
    robertogozzi
    Moderator
    Master

    Two cases:

    1. the conditions need to be met on ALL periods
    2. the conditions need to be met on AT LEAST ONE of the periods
    IF summation[period](condition) = period THEN
       do_someting
    ENDIF
    IF summation[period](condition) THEN
       do_someting
    ENDIF
    Albert Kader thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Testing a condition on a defined number of bars


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Albert Kader @azenkwed Participant
Summary

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

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