Pricing Parameters
Pricing parameters define entry points, stop losses, and take profit levels for your trades.
entry_price
- Type:
float - Required: No
- Description: Target price for entering the position
Details
If not specified, the order will use market price. For limit orders, this sets the exact price at which to enter.
Usage
- Market orders: Can be omitted (uses current market price)
- Limit orders: Required for
LIMITorder type - Stop orders: Sets the trigger price
Automatic Adjustments
The system may adjust entry price if:
- Price is too far from market (exchange limits)
- Price doesn't meet minimum tick size requirements
- Account type or margin mode restrictions apply
Examples
// Limit order with specific entry price
{
"strategy_key": "your_key",
"position_side": "LONG",
"action": "BUY",
"entry_price": 50000,
"entry_order_type": "LIMIT"
}
// Market order (no entry price needed)
{
"strategy_key": "your_key",
"position_side": "LONG",
"action": "BUY",
"entry_order_type": "MARKET"
}
stop_loss_price
- Type:
float - Required: No
- Description: Price level at which to close the position to limit losses
Details
When price reaches this level, a stop loss order is triggered to close the position.
Direction Requirements
For LONG positions:
- Stop loss must be below entry price
- Example: Entry 50000, Stop Loss 48000
For SHORT positions:
- Stop loss must be above entry price
- Example: Entry 50000, Stop Loss 52000
Automatic Adjustments
If stop loss is less than 1% of entry price, it's automatically adjusted to 1%:
// LONG: stop_loss < entry * 0.01
if (stopLoss < entryPrice * 0.01) {
stopLoss = entryPrice * 0.01;
}
Dynamic Updates
You can update stop loss after position is open:
{
"strategy_key": "your_key",
"position_side": "MOVE_STOP_LOSS",
"stop_loss_price": 49000,
"trade_id": "abc123"
}
Examples
// LONG position with stop loss
{
"strategy_key": "your_key",
"position_side": "LONG",
"action": "BUY",
"entry_price": 50000,
"stop_loss_price": 48000
}
// SHORT position with stop loss
{
"strategy_key": "your_key",
"position_side": "SHORT",
"action": "SELL",
"entry_price": 50000,
"stop_loss_price": 52000
}
take_profit_price
- Type:
float - Required: No
- Description: Price level at which to close the position to secure profits
Details
When price reaches this level, a take profit order is triggered to close the position.
Direction Requirements
For LONG positions:
- Take profit must be above entry price
- Example: Entry 50000, Take Profit 55000
For SHORT positions:
- Take profit must be below entry price
- Example: Entry 50000, Take Profit 45000
Automatic Adjustments
If take profit is less than 1% of entry price (SHORT only), it's automatically adjusted to 1%:
// SHORT: take_profit < entry * 0.01
if (takeProfit < entryPrice * 0.01) {
takeProfit = entryPrice * 0.01;
}
Dynamic Updates
You can change the take profit after the position is open with MOVE_STOP_LOSS. It replaces both orders, so send the stop-loss you want to keep as well:
{
"strategy_key": "your_key",
"exchange": "BINANCE",
"ticker": "BTCUSDT.P",
"position_side": "MOVE_STOP_LOSS",
"stop_loss_price": 49000,
"take_profit_price": 56000
}
Examples
// LONG position with take profit
{
"strategy_key": "your_key",
"position_side": "LONG",
"action": "BUY",
"entry_price": 50000,
"take_profit_price": 55000
}
// SHORT position with take profit
{
"strategy_key": "your_key",
"position_side": "SHORT",
"action": "SELL",
"entry_price": 50000,
"take_profit_price": 45000
}
Complete Example with All Pricing Parameters
{
"strategy_key": "your_key",
"exchange": "BINANCE",
"ticker": "BTCUSDT.P",
"position_side": "LONG",
"action": "BUY",
"entry_price": 50000,
"stop_loss_price": 48000,
"take_profit_price": 55000,
"entry_order_type": "LIMIT",
"leverage": 10
}
Price Validation Rules
For LONG Positions (BUY)
stop_loss_price < entry_price < take_profit_price
Example:
- ✅ SL: 48000, Entry: 50000, TP: 55000
- ❌ SL: 52000, Entry: 50000, TP: 55000 (SL too high)
- ❌ SL: 48000, Entry: 50000, TP: 49000 (TP too low)
For SHORT Positions (SELL)
take_profit_price < entry_price < stop_loss_price
Example:
- ✅ TP: 45000, Entry: 50000, SL: 52000
- ❌ TP: 55000, Entry: 50000, SL: 52000 (TP too high)
- ❌ TP: 45000, Entry: 50000, SL: 48000 (SL too low)
Common Errors
| Error | Cause | Solution |
|---|---|---|
| "Stop loss must be lower than take profit" | For LONG: SL is higher than or equal to TP | Set SL < Entry < TP |
| "Stop loss must be higher than take profit" | For SHORT: SL is lower than or equal to TP | Set TP < Entry < SL |
| "Invalid entry price" | Price outside exchange limits | Check exchange min/max prices |
| "Price precision error" | Too many decimal places | Use exchange's tick size |
Best Practices
1. Always Use Stop Loss
// ✅ Good: Has stop loss protection
{
"position_side": "LONG",
"entry_price": 50000,
"stop_loss_price": 48000
}
// ⚠️ Risky: No stop loss
{
"position_side": "LONG",
"entry_price": 50000
}
2. Calculate Risk/Reward Ratio
// Example: 2:1 risk/reward
const entryPrice = 50000;
const riskAmount = 2000; // 4% risk
const rewardAmount = 4000; // 8% reward
const signal = {
entry_price: entryPrice,
stop_loss_price: entryPrice - riskAmount, // 48000
take_profit_price: entryPrice + rewardAmount // 54000
};
3. Use Trailing Stops for Trend Following
Instead of fixed take profit, use trailing stops:
{
"strategy_key": "your_key",
"position_side": "LONG",
"entry_price": 50000,
"stop_loss_price": 48000,
"take_profit_price": 53000,
"is_trailing_stop_enabled": true,
"callback_rate": 1.0
}
4. Update Stops to Break Even
After profit, move stop loss to entry:
// Initial entry
{
"entry_price": 50000,
"stop_loss_price": 48000,
"trade_id": "BTC_001"
}
// Later: Price reached 52000, move SL to break even
{
"position_side": "MOVE_STOP_LOSS",
"stop_loss_price": 50000,
"trade_id": "BTC_001"
}
Next Steps
- Order Types - Control how orders are executed
- Trailing Stops - Dynamic stop loss management
- Examples - Complete signal examples