Infinite loop within the program!

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26320 quote
    farisalmeerfarisalmeer
    Participant
    New

    Hi, I have written the program below for ProScreener:

    Condition1 = Volume > 1000000
    
    Period = 30
    Condition2 = Close/Close[Period] > 1
    
    HighestNegativePercentageDifference = 0
    FOR i = Period DOWNTO 1 DO
    FOR j = i DOWNTO 1 DO
    IF Close[i] > Close[j-1] THEN
    Percentage = (1-(Close[j-1]/Close[i]))*100
    IF Percentage > HighestNegativePercentageDifference THEN
    HighestNegativePercentageDifference = Percentage
    ENDIF
    ENDIF 
    NEXT
    NEXT
    
    PercentIncreaseOverPeriod = Close/Close[Period] 
    
    Ratio = PercentIncreaseOverPeriod/HighestNegativePercentageDifference
    
    SCREENER[Condition1 AND Condition2](Ratio AS "Ratio")
    

    I attached a screenshot of the error that appears. Could someone please assist me and let me know what am I doing wrong?
    Thank you.

    Error.png Error.png
    #26530 quote
    NicolasNicolas
    Keymaster
    Legend

    Nested FOR/NEXT loops are a nightmare for the proscreener engine to correctly compute. That’s why you get this error window, even if your code is looking ok.

    You’ll have to find a solution with a SUMMATION of boolean conditions results for your second nested FOR/NEXT loop between line 8 to 15.

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

Infinite loop within the program!


ProScreener: Market Scanners & Detection

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by NicolasNicolas
9 years, 6 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 02/25/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...