Multiple conditions for a do loop

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #84196 quote
    simeongsimeong
    Participant
    Average

    I was just wondering if it is possible to create a do loop with multiple conditions because the documentation only show a do loop with one condition  ?

    count = 0
     
    for i = 1 to 4 do
     
     x = low < Low[i] and  high > high[i]
     
     if x then 
      count = count +1
     endif  
     
    next
     
    return count
    count = 0
     
    for i = 1 to 4 do
     
     x = low < Low[i] and  high > high[i]
    xx=dayOpen[1]-dayOpen[2]
     
     if x and xx then 
      count = count +1
     endif  
     
    next
     
    return count
    #84199 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    You can certainly do that, provided you write line 6 correctly:

    xx=dOpen(1)-dOpen(2)

    unfortunately testing XX at line 8 makes no sense, since it will ALWAYS be true; whether positive or negative there will always be (well… it’s not 100% granted, but it’s quite rare otherwise) a difference in price between the opening of two different days!

    #84294 quote
    NicolasNicolas
    Keymaster
    Legend

    Sure you can do that, you can add any other codes in a loop, even another loop. Coding with loops is the main subject of the advanced programming course.

Viewing 3 posts - 1 through 3 (of 3 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

Multiple conditions for a do loop


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
simeong @simeong Participant
Summary

This topic contains 2 replies,
has 3 voices, and was last updated by NicolasNicolas
7 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/05/2018
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...