Actions16
- Account Actions
- Trading Actions
- Market Data Actions
Overview
This node integrates with the FXCM trading platform to perform various account and trading operations. Specifically, for the Account - Modify Position operation, it allows users to update an existing open position's stop loss and take profit levels. This is useful for traders who want to adjust risk management parameters on their trades without closing and reopening positions.
Common scenarios include:
- Adjusting stop loss or take profit after market conditions change.
- Managing open positions dynamically based on new analysis or strategy updates.
Example: A user has an open EUR/USD position and wants to increase the take profit level to capture more potential gain while tightening the stop loss to reduce risk.
Properties
| Name | Meaning |
|---|---|
| instrument | Trading instrument to get data for (e.g., "EUR/USD"). |
| positionId | The unique identifier of the position to modify. |
| stopLoss | New stop loss value to set for the position (optional; can be used to tighten or widen). |
| takeProfit | New take profit value to set for the position (optional; can be used to increase gains). |
Note: Only instrument was provided in the input properties JSON, but from the code context, positionId, stopLoss, and takeProfit are also required inputs for modifying a position.
Output
The node outputs a JSON object representing the modified position details as returned by the FXCM API client. This typically includes updated position information such as new stop loss and take profit values, position status, and other relevant trade metadata.
No binary data output is involved.
Example output structure (simplified):
{
"positionId": "123456",
"instrument": "EUR/USD",
"stopLoss": 1.1000,
"takeProfit": 1.1500,
"status": "modified",
...
}
Dependencies
- Requires an active FXCM API connection configured via credentials that provide necessary authentication tokens.
- Uses the internal
FxcmClientclass to communicate with FXCM's API. - Node expects proper configuration of the FXCM API credential within n8n.
Troubleshooting
Common issues:
- Invalid or expired API credentials will cause authentication failures.
- Providing an incorrect or non-existent
positionIdwill result in errors when attempting to modify a position. - Missing required parameters like
positionIdor invalid numeric values for stop loss/take profit may cause request failures.
Error messages:
- Authentication errors: Check that the API key/token is valid and has sufficient permissions.
- Position not found: Verify the
positionIdcorresponds to an open position. - Validation errors: Ensure stop loss and take profit values are within acceptable ranges and correctly formatted.
Resolution tips:
- Double-check all input parameters before execution.
- Use the FXCM platform or API documentation to confirm valid position IDs and parameter formats.
- Enable "Continue On Fail" option in the node to handle errors gracefully during workflows.
Links and References
- FXCM API Documentation
- FXCM Trading Platform
- n8n Documentation on Creating Custom Nodes