Infinite loop within the program!

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26320 quote
    farisalmeer
    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
    Nicolas
    Keymaster
    Master

    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.

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 Nicolas
9 years ago.

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