English
Back

Common error messages in backtesting

In historical backtesting, if you see the following error messages in the logs, you can resolve the issues based on the following table:

Error Messages Scenarios
Insufficient buying power. For security backtest accounts: If the quantity of the buy order exceeds the maximum buyable limit or the quantity of the sell order exceeds the available short-sell limit, such an error message will appear.
For futures backtest accounts: If the maximum buying power of the account is less than the number of contracts multiplied by the initial margin per contract, such an error message will appear.
Insufficient positions. When closing a long position, if the quantity of sell orders exceeds the available quantity for sale, such an error message will appear.
When closing a short position, if the quantity of buy orders exceeds the quantity needed to buy back for closing, such an error message will appear.
To switch positions, you need to close the open position first and then open a new position in the opposite direction. You can't reverse the position with a single order.
Order quantity must be round lots. If the order quantity is not a multiple of the lot size, an error message will appear. This is commonly used for Hong Kong stocks or A-shares.
You still have pending order of this stock in the opposite direction. Please cancel the opposite direction order and try again. If you place a limit buy order, wait for it to be filled, and then place a sell order, such an error message will appear in the following two scenarios:
1. The sell order is a market order.
2. The sell order is a limit order, and the sell price is less than or equal to the buy price.

If you place a limit sell order, wait for it to be filled, and then place a buy order, such an error message will appear in the following two scenarios:
1. The buy order is a market order.
2. The buy order is a limit order, and the buy price is greater than or equal to the sell price.
There is insufficient stock available for short sale. When placing a short sell order, if the sell quantity exceeds the number of shares available for lending, sunch an error message will appear.
The number of shares available for lending is the same as the real-time quantity at the backtest start. Sufficient shares available for margin are also required for short selling.
The stock is not eligible for short selling. For stocks that do not support short selling, such an error message will appear when placing a short sell order. This is commonly used for A-shares and some leveraged ETFs.
These products are currently untradeable, but will be available soon. Such an error will appear if you place an order for a product that is not currently unavialble for trading. Click here to find which products are availble for trading in the backtesting.
Invalid price. Pease enter the correct price Such an error message will appear if you enter a price that is not within the valid price range.
Trigger price should greater than market price. Such an error will appear if the trigger price for a limit sell order is less than or equal to the market price.
Such an error will appear if the trigger price for a stop loss limit buy order is less than or equal to the market price.
Trigger price should less than market price. Such an error will appear if the trigger price for a limit buy order is greater than or equal to the market price.
Such an error will appear if the trigger price for a stop loss limit sell order is greater than or equal to the market price.
The order can't be transmitted during non-trading hours. For futures, if you place or cancel an order during a non-trading session, such an error message will appear.
You already have a long order. Can't add short orders When you have no initial holdings and place a limit buy order to wait for it to be filled, such an error message will appear when placing a short sell order.
You already have a short order. Can't add long orders When you have no initial holdings and place a limit short sell order to wait for it to be filled, such an error message will appear when placing a buy order.