English
Back
No matches yet
Operations too frequent. Please try again later.
Please check network settings and try again Refresh Refresh
Loading
History record delete
    Quotes All >
      News All >
        Log in to access Online Inquiry
        Back to the Top

        How to handle exceptions in strategy running

        When running a strategy, exceptions may happen to the Conditions Cards and/or Operations Cards, 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".

         

        1. Exceptions in "Start" Card

        "Start" Card 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.

         

        2. Exceptions in Conditions Cards and/or Operations Cards

        In the parameter setting interface of "Live Trading" or "Backtesting", you can choose from the following three exception handling methods:

        2.1 Skip the current Condition Cards or Operation Cards and continue from the next one

        In this method, exceptions in Operations Cards are handled in a way slightly different from that in Conditions Cards.

        Operations Cards: When the strategy runs to the Operation Card "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".

        (Please note that the interface shown in the screenshot may differ from the one on your device if your app version is not up-to-date. Any securities or strategies appearing in the screenshot are for illustration only and do not constitute any investment advice.)

        Conditions Cards: When running to the Condition Card "Take-Profit Conditions Met?" on path 2, and an exception happens, the strategy will skip that Condition and re-start from the first Condition Card or Operation Card on the next path (path 3).

        (Please note that the interface shown in the screenshot may differ from the one on your device if your app version is not up-to-date. Any securities or strategies appearing in the screenshot are for illustration only and do not constitute any investment advice.)

        2.2 Skip the current path and continue from the next one

        If an exception occurs when the strategy runs to the Condition Card "Take-Profit Conditions Met?" on path 2, it will skip the Condition and continue to run from the first Condition Card or Operation Card on the next path (path 3).

        (Please note that the interface shown in the screenshot may differ from the one on your device if your app version is not up-to-date. Any securities or strategies appearing in the screenshot are for illustration only and do not constitute any investment advice.)

        (Please note that the interface shown in the screenshot may differ from the one on your device if your app version is not up-to-date. Any securities or strategies appearing in the screenshot are for illustration only and do not constitute any investment advice.)

        2.3 Skip the current round and continue from the next one

        When running to the Condition Card "Take-Profit Conditions Met?" on path 2, and an exception happens, the strategy will skip that Condition as well as all unexecuted Conditions Cards or Operations Cards, and re-start from the first Condition Card or Operation Card on path 1 if it is triggered again for another round.

        (Please note that the interface shown in the screenshot may differ from the one on your device if your app version is not up-to-date. Any securities or strategies appearing in the screenshot are for illustration only and do not constitute any investment advice.)

        (Please note that the interface shown in the screenshot may differ from the one on your device if your app version is not up-to-date. Any securities or strategies appearing in the screenshot are for illustration only and do not constitute any investment advice.)

         

        3. Special Note

        Value Assignment Card

        When the strategy runs to "Value Assignment Card" 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).

        Any app images provided are not current and any securities shown are for illustrative purposes only and is not a recommendation. Results may vary with each use and over time and do not reflect actual investment results and are not guarantees of future results.

        Losses can happen more quickly with quant and algorithmic trading compared to other forms of trading. Trading financial markets are inherently risky. Thus, an important component of quantitative trading systems is risk management. Risk is essentially anything that can interfere with the successful performance of a quantitative trading system. In the market, quants face different types of risks. There is, of course, market risk, which means that price changes of underlying financial assets can be fast and dynamic such that losing trades are generated. But this is not the only risk quants are exposed to. There is also capital allocation, technology risk, broker risk, and even personality risk (but this can be mitigated with automation). Automatic investment strategies do not ensure a profit or protect against losses. The responsiveness of the trading system or app may vary due to market conditions, system performance, and other factors. Account access, real-time data, and trade execution may be affected by factors such as market volatility.

        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.