FUTU HK Help Center-How to avoid repeated opening of positions
English
Back
Open Account
Clear
All
Quotes
News
Learn
Help
All
HK
US
CN
SG
AU
JP
CA
MY
All
News
Announcements
Reports

How to avoid repeated opening of positions

If a signal continuously meets the condition, the strategy may repeatedly execute the ”Place Order Card” .

How to ensure the strategy buys or sells only once when the signal meets the condition? Here are the two simplest methods.

Method 1: Determine positions

If the strategy places a type of order that can be filled quickly (e.g., a market order), then you can indirectly determine whether a position has been opened or closed successfully through the underlying stocks you are holding.

● If the number of underlying stocks you are holding is > 0, then the position has been opened successfully, and the path to close positions will run;

● If the number of underlying stocks you are holding is 0, then the position has been closed successfully or has not been opened, and the path to open positions will run;

Note: This method requires that the order must be filled quickly; otherwise repeated orders may still be placed.

Method 2: Use a counter

If the strategy places a type of order that may not be filled quickly (e.g., a limit order), you can create a value global variable as a counter to indicate whether an order has been placed.

Step 1: Go to “Start Card" > Properties > Global Variables, and create a counter named "a" to indicate whether a buy/sell order has been placed.

● If a buy order has been placed and has held position , it will be represented by 1;

● If no order has been placed and no position is held, it will be represented by 0;

According to the above rules, the value of the global variable "a" is 0 by default (indicating that no order has been placed and no position is held).

Step 2: Determine the global variable "a" and the number of holdings first when the strategy starts to run:

● If "a" = 0, and the number of holdings = 0, it means that no order has been placed and no position is held, and the path to open positions will run;

● If "a" = 1, and the number of holdings > 0, it means that a buy order has been placed and there are positions held (the buy order has been filled), and the path to close positions will run;

Step 3: Add an ”Value Assignment Card” after the ”Place Order Card” , and re-assign value to the global variable "a":

● Path to close positions: re-assign 0 to the global variable "a" to indicate a sell order has been placed.

● Path to open positions: re-assign 1 to the global variable "a" to indicate a buy order has been placed.

Market Insights

Market Hot Picks Market Hot Picks
Unlock Now

Discussing

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