FUTU HK Help Center-How to handle exceptions in strategy running
English
Back
Open Account
Clear
All
Quotes
News
Learn
Help
All
HK
US
CN
SG
AU
JP
CA
MY
All
News
Announcements
Reports
No matches yet
Operations too frequent. Please try again later.
Please check network settings and try again Refresh Refresh
Loading
History record
    Latest News
      Quotes More
      News More
      Learn More
      Help More
      Loading
      News More
      Announcements More
      Reports More

      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 "Running Order of Conditions Cards & Operations Cards".

      1. Exceptions in "Start" Card

      The "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 erroneous card

      Exit the erroneous card and advance to the next card on the path.

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

      Any images provided are not current and any securities shown are for illustrative purposes only and are not recommendations.

      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).

      Any images provided are not current and any securities shown are for illustrative purposes only and are not recommendations.

      2.2 Skip the erroneous path

      Exit the erroneous path and advance to the next one starting from the "Start" card.

      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).

      Any images provided are not current and any securities shown are for illustrative purposes only and are not recommendations.
      Any images provided are not current and any securities shown are for illustrative purposes only and are not recommendations.

      2.3 Skip the erroneous strategy cycle

      Skip the rest of the current strategy cycle and continue with the next iteration when triggered.

      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.

      Any images provided are not current and any securities shown are for illustrative purposes only and are not recommendations.
      Any images provided are not current and any securities shown are for illustrative purposes only and are not recommendations.

       

      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).
      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.

      Market Insights

      Discussing

      關稅風暴暫離高壓區!市場能否迎來反彈?
      當地時間4月22日,美國總統特朗普公開承認美國目前對中國出口商品的關稅過高,預計稅率將大幅降低;美國財政部長貝森特也表示中美雙方關稅戰將很快降溫。4月25日,特朗普表示將爲不同國家設定「公平的」關稅稅率。特朗普此次對華關稅態度的轉變,能否平息市場恐慌情緒?關稅拉鋸戰最終結局如何? Show More