Terminating Probuilder scripts.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #235664 quote
    MCG
    Participant
    New

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

    #235665 quote
    druby
    Participant
    New

    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.

    Iván González and MCG thanked this post
    #235670 quote
    PeterSt
    Participant
    Master

    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

    MCG thanked this post
    #235686 quote
    MCG
    Participant
    New

    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 quote
    MCG
    Participant
    New

    Thanks, Drudy.

    See my answer to PeterSt further on.

    Manuel

    #235688 quote
    PeterSt
    Participant
    Master

    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 :

    If NoDangerYet then
    
      // Your Indicator code.
    
    Endif
    
    Return
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Terminating Probuilder scripts.


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
MCG @mcg Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by PeterSt
1 year, 6 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/23/2024
Status: Active
Attachments: No files
Logo Logo
Loading...