Terminating Probuilder scripts.

Forums ProRealTime English forum ProBuilder support Terminating Probuilder scripts.

Viewing 6 posts - 1 through 6 (of 6 total)
  • #235664
    MCG

    How to immediately terminate a script (in Probuilder) if a certain circumstance occurs?

    #235665

    Interesting, most posts on here are about trying  get/keep scripts going.

    In probacktest code command section there’s ‘QUIT’

    https://www.prorealcode.com/documentation/quit/

    However, for indicator I don’t think there is one.

    Only way would be to force a known error after condition met.

    IF condition THEN

    Highest[-1]

    ENDIF

    This would throw a negative index error. Different ones, LOWEST[-1] could give option if different fail condition need to be set.

    Some of these tricks work beyond indicators.

    However, the only consistency between indicators, backtest and algo’s, is there inconsistency.

    Don’t assume what works in one will work in other, or at least the same. best to check first.

    2 users thanked author for this post.
    #235670

    How to immediately terminate a script (in Probuilder)

    Hello Manuel,

    Because you said “ProBuilder” people assume you referred to Indicator code.
    But it seems not making sense to “immediately quit” an Indicator. So assumed you meant to refer to Strategy code :

    If you randomly Quit (which indeed is the command for it), Open Positions will be thrown out. Whether this (already) has been activated for PRT-IG I don’t know. But for PRT-IB it sure is. This is so since last June 17.

    Regards,
    Peter

    1 user thanked author for this post.
    avatar MCG
    #235686
    MCG

    Hi Peter,
    Actually, in my post, I DO refer to the code of an indicator. Suppose, I open the chart for a certain instrument and it only contains one year of data. In that case, I don’t want to continue running the indicator because I know it will cause an error and then PRP will disconnect the indicator from the chart. A previous test on the number of years would avoid that inconvenience and handle the situation gracefully. In all the languages ​​I know, there is a statement like “quit” or equivalent that immediately suspends the execution of the code and returns control to the operating system. Is there something similar in Probuilder?
    Regards,
    Manuel

    #235687
    MCG

    Thanks, Drudy.

    See my answer to PeterSt further on.

    Manuel

    #235688

    Well, nice … I touch some I think F-key by accident, and the PRC browser screen is replaced by a stupid GitHub screen.

    Hi again, Manuel,

    I don’t feel the lust to type all again (maybe later). But summarized : Use If in the Indicator under which your code is  executed, which If gets false when there’s danger around the corner. Under the Endif Return.

    Sorry …
    Regards,
    Peter

    Edit :

     

Viewing 6 posts - 1 through 6 (of 6 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login