Maximum code length & max number of IF's

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #44307 quote
    Thomas007
    Participant
    Senior

    Does anyone know what the maximum of IF’s are allowed within one strategy before it gets “confused”? And what is the max length of the code.

     

    I wonder if I can put as many conditions in one strategy as I only require. And what would be you suggestion to make the code less cluttered as possible?

    #44337 quote
    juanj
    Participant
    Master

    I have not yet run into issues with the number of If and even nested if statements used (or lines of code for that matter).

    But I do experience issues when using 2 or more loops (however number of iterations could maybe also play a role).

    Thomas007 thanked this post
    #44341 quote
    Wing
    Participant
    Veteran

    I tried this one time and I believe the maximum amount of IF statements/actions per iteration is something like 1000-2000. As for maximum code length it is somewhere around 10000-20000 lines of code I believe. If you really want to know you can test it yourself.

    Thomas007 thanked this post
    #44342 quote
    robertogozzi
    Moderator
    Master

    Here you may want to find clues and hints on some improvements for screeners (and strategies as well): https://www.prorealcode.com/blog/learning/speed-calculation-indicator/

    Too many nested IFs can lead to slower execution and, maybe, some interpretation issues. It is preferrable to use multiple conditions on the same line, example:

    //   instead of:
    IF a THEN
       IF b THEN
          IF c THEN
             .
             .
             .
          ENDIF
       ENDIF
    ENDIF
    //    it is preferrable to write:
    IF a AND b AND c THEN
       .
       .
       .
    ENDIF
    Thomas007 thanked this post
    #44375 quote
    Despair
    Blocked
    Master

    …I think long before you have reached the point that PRT gets “confused” you will reach a point that backtesting your strategy is painfully slow.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Maximum code length & max number of IF's


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Thomas007 @flawless007 Participant
Summary

This topic contains 4 replies,
has 5 voices, and was last updated by Despair
8 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/21/2017
Status: Active
Attachments: No files
Logo Logo
Loading...