Testing a condition on a defined number of bars

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #138379 quote
    Albert KaderAlbert 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
    robertogozzirobertogozzi
    Moderator
    Legend

    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.
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

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 robertogozzirobertogozzi
6 years, 3 months ago.

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