The cTrader handler in our project implements two primary modes of operation:
Below is a detailed explanation of their logic and differences.
To completely close existing positions for a specified instrument and, if required, open a new position.
symbol
(LONG or SHORT), they will be closed using the close_order
function.place_order
.This mode is ideal for strategies requiring all existing positions to be closed to prevent overlapping assets. For example, a trader wants to ensure no old positions are held before opening a new order.
To open a new position without closing existing ones.
place_order
function regardless of the currently open positions.This mode is suitable for strategies requiring simultaneous positions in both directions (LONG and SHORT). For example, hedging risk where the trader wants to safeguard open positions.
Characteristic | Reverse Mode | Hedge Mode |
---|---|---|
Closing existing positions | Yes | No |
Opening new positions | Only after closing | Always |
Suitable for position reversal | Yes | No |
Suitable for hedging | No | Yes |
Scenario:
Current Position: LONG 1 lot on EURUSD.
Signal: SHORT 1 lot.
Result:
The handler closes the existing LONG position. A new SHORT position will not be opened automatically (unless specified separately).
Scenario:
Current Position: LONG 1 lot on EURUSD.
Signal: SHORT 1 lot.
Result:
The handler opens a new SHORT position without closing the LONG position.
Our connector exclusively uses market orders to ensure fast and reliable operation. However, the cTrader API does not support setting Stop-Loss (SL) or Take-Profit (TP) values directly when creating market orders.
This logic makes our connector a more reliable and versatile tool for integrating TradingView and cTrader. Users can select the appropriate mode based on their strategy.