Integrating your OKX account with MultiCharts enables powerful automated trading and advanced charting capabilities. This guide provides a detailed walkthrough for configuring both Futures and Spot broker profiles, ensuring a smooth and reliable connection.
Before you begin, ensure you have generated your API Key and Secret Key from your OKX account. These credentials are essential for establishing a secure link between the platforms. Additionally, verify that the OKX data feed is correctly set up within MultiCharts to receive real-time market data.
Configuring the OKX Futures Broker Profile
To start trading futures, you must first configure the broker profile within MultiCharts. Access the OKX Futures Settings window through the Broker Profiles management section.
Main Tab Configuration
The Main tab houses the critical settings for connectivity and order management.
Connectivity Section
In this section, you input the credentials that authorize the connection.
- API Key & Secret Key: Enter the keys obtained from your OKX account.
- API Key Password: Provide the additional password associated with your API key.
- Currency: Select your account's base currency (e.g., USDT).
- Server: Choose the server location (e.g., EU, US) where your API key was registered.
- Demo Account: Check this box if you are connecting a demo or testnet account.
Default Order Settings Section
This section defines how your orders are handled by default.
- Time in Force: Select an order duration policy like Good-'Til-Canceled (GTC).
- Orders Request Waiting Limits: Enable this to allow MultiCharts to manage request rates automatically, adhering to OKX's API limits on requests per minute.
- Isolated Margin Mode: Activate this to isolate the margin for a specific position, protecting your overall account balance.
- Reduce Only: A crucial option for closing positions. Enabling it ensures orders are only used to reduce an existing position, helping to circumvent OKX's minimum trade size limit during exit trades.
Global Section
These settings enhance the stability and feedback of your connection.
- Timing Security: Set a time interval (in milliseconds) during which a request is considered valid.
- Heartbeats for Connection Loss Detection: Enable this to allow MultiCharts to automatically detect and attempt to reconnect after a temporary connection loss.
- Show Error Pop-up Alert: Keep this enabled to receive immediate on-screen notifications for any connection or order errors.
Understanding the Contracts Ratio Tab
A key concept for trading cryptocurrencies on OKX via MultiCharts is the Contracts Ratio. Since MultiCharts does not support trading fractional shares, this ratio acts as a multiplier.
The value in this tab represents how one contract in MultiCharts translates to contracts on the OKX exchange. For instance, if the Contracts Ratio for AVAX-USDT-SWAP is set to 0.1, an order for 1 contract in MultiCharts will result in an order for 0.1 contracts on OKX. Always verify this ratio against the minimum trade size requirements on OKX to avoid order rejections.
👉 Explore more strategies for managing contract sizes
How OKX Futures Trading Works in MultiCharts
It's important to understand how data and orders are processed between the two platforms.
Data Handling: OKX provides real-time data on account lists, balances, and open positions. However, equity calculations and open position Profit/Loss (P&L) are computed on the MultiCharts side.
Order Types: MultiCharts supports a full suite of order types for OKX Futures, including Market, Limit, Stop, and Stop-Limit orders.
OCO Groups: One-Cancels-the-Other (OCO) orders are emulated by MultiCharts. This means MultiCharts sends both orders to the broker and actively monitors the market price. When one order is filled, it immediately sends a cancellation command for the paired order. Be aware of the inherent risk: if the market moves extremely fast, the second order might be filled before the cancellation can be processed by the broker's server.
Configuring the OKX Spot Broker Profile
The setup process for Spot trading is similar to Futures but with a few distinct differences, primarily concerning how positions are handled.
Main Tab Configuration for Spot
The Connectivity and Global sections in the Spot profile are identical to the Futures setup. Enter your API Key, Secret Key, select the correct server and currency, and configure your timing and heartbeat preferences.
The Default Order Settings section for Spot is slightly simplified. You will still set the Time in Force and Orders request waiting limits, but options like Isolated Margin and Reduce Only are not applicable for spot trading.
Contracts Ratio and Position Emulation in Spot
The Contracts Ratio functions the same way in Spot trading. For example, a ratio of 0.001 for BTCUSDT means a 1-contract order in MultiCharts becomes a 0.001 BTC order on OKX.
The most significant difference with Spot trading is position emulation. Since OKX operates with a wallet system rather than a traditional position-based system, MultiCharts must emulate positions for its trading logic.
- Open Positions Tab: This is where you manage emulated positions.
- Lookup: This button instructs MultiCharts to scan its own order history to build a record of your current positions. It will not be aware of trades made outside of MultiCharts.
- Recalculate: Use this to force MultiCharts to rebuild its position history from orders starting from a specific date.
- Add: Manually add a symbol to the positions list.
Note: When a position is opened, the executed volume on OKX will be slightly less than specified due to the trading commission taken from the base currency. To ensure positions are closed accurately, it is highly recommended to use the From Broker To Strategy MP Synchronizer power tool.
Troubleshooting Common Connection and Order Issues
Even with a correct setup, you may occasionally encounter issues.
Broker Profile Connection Failures
If clicking Connect does not establish a connection:
- For Futures, ensure you have pressed the Lookup button in the Leverage tab.
Check the Logs tab in the Order and Position Tracker.
- If you see a
Timestamp for this request is outside of the recvWindowerror, synchronize your computer's clock through the Date & Time settings. - An
Invalid API-key, IP, or permissions for actionerror indicates an issue with your API credentials. Check for emails from OKX, contact their support, or generate a new API key.
- If you see a
Orders Being Rejected
Always check the Logs tab for the specific rejection reason.
- "Minimum trade volume = X": Your order size is too small. Remember to apply the Contracts Ratio. An order for 1 contract in MultiCharts is multiplied by the ratio (e.g., 0.01) on OKX. This final value must meet OKX's minimum.
"Not found symbol from server X and currency Y":
- Re-add the symbol in QuoteManager from the OKX data source.
- Confirm you are using the OKX Futures profile for futures symbols and the OKX Spot profile for spot symbols.
- Verify the server and currency settings in your broker profile match the symbol you are trading.
- "Order’s notional must be no smaller than 5.0": When closing a futures position, enable the Reduce Only option in the Main tab to bypass the minimum trade size restriction.
Frequently Asked Questions
What are the main differences between Futures and Spot profiles in MultiCharts?
The Futures profile supports margin trading, isolated margin mode, and reduce-only orders. The Spot profile involves direct asset trading from your wallet and requires MultiCharts to emulate your trading positions based on its order history.
Why are my orders being rejected for being too small?
MultiCharts trades in whole integers, but OKX requires a minimum trade size. The Contracts Ratio bridges this gap. You must ensure that your order size in MultiCharts, when multiplied by the Contracts Ratio, meets or exceeds OKX's minimum requirement for that specific asset.
How does MultiCharts handle OCO orders?
MultiCharts uses an emulated OCO system. It submits both orders to the broker and manages the OCO logic internally. If one order is filled, it sends a cancel command for the other. There is a small risk of the second order filling before the cancel command is processed during volatile market conditions.
What should I do if my positions in MultiCharts don't match my OKX wallet?
For Spot trading, always use the Lookup or Recalculate buttons in the Open Positions tab to sync MultiCharts with its own order history. For the most accurate synchronization, utilize the From Broker To Strategy MP Synchronizer tool.
Why is my connection failing with a timestamp error?
This error occurs when your computer's clock is out of sync with OKX's servers. Use the "Sync now" feature in your computer's date and time settings to resolve this.
Where can I find the Contracts Ratio for a specific symbol?
The Contracts Ratio for each symbol is pre-loaded within the MultiCharts platform. You can find it by navigating to the Contracts Ratio tab within your OKX Futures or Spot broker profile settings.