Set Copy Settings for a master, slave or template. An array of settings is sent in parameter.
URL: https://www.trade-copier.com/webservice/v4/settings/setSettings.php
Response: JSON response description
All fields are optional except id_slave or id_group
| Field Name | Field Type | Field Description |
|---|---|---|
| id_master | string | Unique identifier of the master account. Will be a default setting for all masters if empty |
| id_slave | string | Unique identifier of the slave account. Must be empty if template ID is set |
| id_group | string | Unique identifier of the template. Must be empty if slave ID is set |
| risk_factor_value | float | Value of the risk factor |
| risk_factor_type | int | Risk Factor type or not defined: 0: Auto Risk (Equity) 1: Auto Risk (Balance) 2: Auto Risk (Free Margin) 3: Multiplier (Notional) 4: Fixed Lot 5: Fixed Leverage (Equity) 6: Fixed Leverage (Balance) 7: Fixed Leverage (Free Margin) 10: Fixed Units 11. Multiplier(Lot) |
| order_side | int | -1 = sell only, 1 = buy only |
| max_order_size | float | Maximum order size |
| min_order_size | float | Minimum order size |
| copier_status | int | Status of the setting on the trade copier. -1 = close only, 0 = frozen, 1 = on, 2 = open only |
| symbol_master | string | Symbol on the master's broker. Must be set if symbol field is set |
| symbol | string | Symbol on the slave's broker. Must be set if symbol_master field is set |
| pending_order | int | Enable/disable copying on pending orders. 0 = off, 1 = on |
| stop_loss | int | 0 = off, 1 = on, 2 = on with updates |
| stop_loss_fixed_value | float | |
| stop_loss_fixed_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
| stop_loss_min_value | float | |
| stop_loss_min_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
| stop_loss_max_value | float | |
| stop_loss_max_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
| take_profit | int | 0 = off, 1 = on, 2 = on with updates |
| take_profit_fixed_value | float | |
| take_profit_fixed_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
| take_profit_min_value | float | |
| take_profit_min_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
| take_profit_max_value | float | |
| take_profit_max_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
| trailing_stop_value | float | |
| trailing_stop_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
| max_risk_value | float | |
| max_risk_format | int | 0 = %, 1 = amount, 2 = pips, 3 = decimal |
| comment | string | |
| max_slippage | float | Max slippage in pips |
| max delay | float | Max delay in seconds |
| force_min_round_up | int | |
| round_down | int | |
| split_order | int | |
| price_type | int | Smart Price adjustment, 0=OFF, 1=ON, empty/null=inherited |
| price_improvement | float | Price improvement in pips |
| max_position_size_a | float | |
| max_position_size_s | float | |
| max_position_size_a_m | float | |
| max_position_size_s_m | float | |
| max_open_count_a | int | |
| max_open_count_s | int | |
| max_open_count_a_m | int | |
| max_open_count_s_m | int | |
| max_daily_order_count_a | int | |
| max_daily_order_count_s | int | |
| max_daily_order_count_a_m | int | |
| max_daily_order_count_s_m | int | |
| global_stop_loss | int | 0 = off, 1 = on |
| global_stop_loss_value | float | |
| global_stop_loss_type | int | 0 = close only, 1 = sell out, 2 = freeze |
| global_take_profit | int | 0 = off, 1 = on |
| global_take_profit_value | float | |
| global_take_profit_type | int | 0 = close only, 1 = sell out, 2 = freeze |
| stop_loss_offset_value | float | Optional positive or negative offset value to adjust the Stop Loss level. |
| stop_loss_offset_format | int | 0 = % of SL price, 1 = cash amount, 2 = pips, 3 = decimal, 4 = % of SL distance |
| take_profit_offset_value | float | Optional positive or negative offset value to adjust the Take Profit level. |
| take_profit_offset_format | int | 0 = % of SL price, 1 = cash amount, 2 = pips, 3 = decimal, 4 = % of SL distance |
| trailing_stop_value | float | Optional positive or negative offset value to adjust the Traing Stop |
| trailing_stop_format | int | 0 = % of Trailing Stop price, 1 = cash amount, 2 = pips, 3 = decimal, 4 = % of Trailing Stop distance |
PHP example
<?php
echo "<link rel='stylesheet' type='text/css' href='https://www.trade-copier.com/webservice/example.css'>";
$url="https://www.trade-copier.com/webservice/v4/settings/setSettings.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Bearer [[TOKEN]]',
);
// Open connection
$ch = curl_init();
// Setting the options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Slave/Group Settings list to be added, updated or removed
$settings = [
['id_slave' => '29524', 'id_master' => '33934', 'risk_factor_value' => '0.11', 'risk_factor_type' => '3', 'max_order_size' => '1.23', 'copier_status' => '0'],
['id_slave' => '29524', 'risk_factor_value' => '0.99', 'risk_factor_type' => '4', 'max_order_size' => '0.12', 'copier_status' => '1'],
['id_group' => '4735', 'risk_factor_value' => '1.02', 'risk_factor_type' => '5', 'max_order_size' => '0.12'],
];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($settings));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
//If updated is successful, we use the getRiskFactors webservice to check the new value
if(array_key_exists('success', $json))
{
echo $json->code."-".$json->success;
}
else
{
//This is an error message that can be access like this:
//echo $json->code." ".$json->error;
echo json_encode($json);
}
?>