Terminating Probuilder scripts.
Forums › ProRealTime English forum › ProBuilder support › Terminating Probuilder scripts.
- This topic has 5 replies, 3 voices, and was last updated 1 month ago by
PeterSt.
-
-
07/23/2024 at 12:56 PM #23566407/23/2024 at 1:46 PM #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.
07/23/2024 at 4:07 PM #235670How 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,
Peter1 user thanked author for this post.
07/23/2024 at 5:58 PM #235686Hi 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,
Manuel07/23/2024 at 6:02 PM #23568707/23/2024 at 6:58 PM #235688Well, 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,
PeterEdit :
1234567If NoDangerYet then// Your Indicator code.EndifReturn -
AuthorPosts