When running a strategy, exceptions may happen to the Conditions and/or Operations, resulting in request failures or data access errors. This article will explain how these exceptions are handled so that you can choose from different methods depending on scenarios.
Before that, it is recommended that you first understand the operating framework under normal circumstances by referring to "How to understand the strategy running framework of moomoo's quant trading feature".
[Start] runs once when the entire strategy is about to begin. If global variables fail to be assigned values (for example: a = 1/0, but 0 cannot be used as the denominator) or cannot access market data, the entire strategy will not be initialized and thus cannot begin.
In the parameter setting interface of Live Trading or Backtest, you can choose from the following three exception handling methods:
In this method, exceptions in Operations are handled in a way slightly different from that in Conditions.
Operations: When the strategy runs to the Operation [Close Position to Take Profit] in path 2, and an exception occurs, the strategy will skip the Operation and continue running from [Initialized Position Cost for Each Price Level].
Conditions: When running to the Condition [Take-Profit Conditions Met?] on path 2, and an exception happens, the strategy will skip that Condition and re-start from the first Condition or Operation on the next path (path 3).
If an exception occurs when the strategy runs to the Condition [Take-Profit Conditions Met?] on path 2, it will skip the Condition and continue to run from the first Condition or Operation on the next path (path 3).
When running to the Condition [Take-Profit Conditions Met?] on path 2, and an exception happens, the strategy will skip that Condition as well as all unexecuted Conditions or Operations, and re-start from the first Condition or Operation on path 1 if it is triggered again for another round.
Value Assignment
When the strategy runs to [Value Assignment] and value assignment fails due to an exception, the global variable will remain the value before the assignment instead of being cleared (for example: when a = high price of a candlestick, but the high price cannot be accessed, a will maintain the original value).
This presentation is for informational and educational use only and is not a recommendation or endorsement of any particular investment or investment strategy. Investment information provided in this content is general in nature, strictly for illustrative purposes, and may not be appropriate for all investors. It is provided without respect to individual investors’ financial sophistication, financial situation, investment objectives, investing time horizon, or risk tolerance. You should consider the appropriateness of this information having regard to your relevant personal circumstances before making any investment decisions. Past investment performance does not indicate or guarantee future success. Returns will vary, and all investments carry risks, including loss of principal. Moomoo makes no representation or warranty as to its adequacy, completeness, accuracy or timeliness for any particular purpose of the above content.