Take profit & stop loss implementation with Limit & Stop orders
Take profit & stop loss implementation with Limit & Stop orders
05 Oct 2017, 13:05
Hey Guys :)
I saw in this post(/forum/fix-api/11377?page=1) that you can not specify the stop loss and take profit with FIX API.
" Essentially a SL and a TP are just a stop order and a limit order associated to a position with the same volume, but in the opposite direction. SL and TP are more of an interface feature that allows you to keep pending orders associated with a position, rather than a specific trading instruction. Therefore we do not plan to make this feature a parts of FIX API. Instead, it is advised to implement SL and TP on your side by opening a stop loss order and, a limit order linked to a position with the same volume and the opposite direction. "
Can you please explain further about how to implement take profit & stop loss with Limit & Stop orders ?
Example: Buy, EURUSD, 1,000, EnterPrice 1.17852
*I would like to close in 10 pips TargetPrice: 1.17952
Which steps I need to take to do it right?
Replies
PanagiotisCharalampous
06 Oct 2017, 09:26
Hi obaum1@gmail.com,
Can you please clarify what do you mean when you say that you have two positions? When you enter the marker with your market order at 1.17852, a position is created. Which is the second one?
Also why do you say that commissions are higher?
In general the steps of your example are correct. You should also remember when an SL/TP order is executed to cancel the other one.
Best Regards,
Panagiotis
@PanagiotisCharalampous
obaum1@gmail.com
07 Oct 2017, 01:08
Hey :)
Thanks for the reply!!
If I understood right. I can't set TakeProfit and StopLoss via the FIX API.
To overcome this problem I need to work with Limit Order & Stop Order.
EXAMPLE:
- 1) I have the following position running:
- 1) (EURUSD, Buy, 1,000, EnterPrice 1.17852)
- 2) I want to set TakeProfit of 10 pips for that position
- 3) I set LimitOrder with (Sell, 1,000, TargetPrice: 1.17952)
- 4) when the target price is triggered now I have two running positions
- 1) (EURUSD, Buy, 1,000, EnterPrice 1.17852)
- 2) (Sell, 1,000, EnterPrice: 1.17952)
- 1) (EURUSD, Buy, 1,000, EnterPrice 1.17852)
- 5) secondPosition - firstPosition = 10 pips
Each
trade commission is around 0.08 -> so I payed 0.16 in commission because I opened two positions.If I open my position via Connect API I can set TakeProfit & StopLoss and the position will "close it self" and I paid 0.08
If this is correct, so maybe I can create trades with the FIX API and modify the position TakeProfit & StopLoss with Connect API?
Thanks!!!
@obaum1@gmail.com
PanagiotisCharalampous
09 Oct 2017, 09:21
Hi obaum1@gmail.com,
when the target price is triggered now I have two running positions
This is not true. If you use tag 721, your order will pe placed to the specified position, hence in this case it will close the position instead of opening a new one.
Each trade commission is around 0.08 -> so I payed 0.16 in commission because I opened two positions.
If I open my position via Connect API I can set TakeProfit & StopLoss and the position will "close it self" and I paid 0.08
Commissions are per side (open/close). You will pay 0.08 when you open a position and 0.08 when you close a position. So in both cases you will pay 0.16.
Best Regards,
Panagiotis
@PanagiotisCharalampous
obaum1@gmail.com
09 Oct 2017, 20:00
Hey Panagiotis,
OK, the tag 721 was super helpful!!!
And thanks in general!!! :)
@obaum1@gmail.com
viniciusfre
20 Mar 2019, 15:05
Hi,
I am trying to modify a position for to set Take profit or Stop loss as per Solid Snake steps, but it is not working.
So I am sending first a buy market message:
side = 1(BUY)
_orderType = 1(OrdType_MARKET)
_symbol = 1 (EURUSD)
_orderQty = 1000
_timeInForce = 3(IMMEDIATE_OR_CANCEL)
_price = 0
_stopPx = 0
And then I send a take profit buy message:
side = 2(SELL)
_orderType = 2(OrdType_LIMIT)
_symbol = 1 (EURUSD)
_orderQty = 1000
_timeInForce = 1(GOOD_TILL_CANCEL)
_price = AvgPx + 0.00032 (32 points gain)
_stopPx = 0
PosMaintRptID = X (Value received in ExecutionReport)
Instead mofify the buy position, the server is creating a pending order. What is wrong?
@viniciusfre
PanagiotisCharalampous
20 Mar 2019, 15:13
Hi viniciusfre,
There is nothing wrong, this is how it should be done. As described above, you cannot set SL and TP via FIX API. Therefore you need to manage orders of the opposite direction. Requoting from the first post
" Essentially a SL and a TP are just a stop order and a limit order associated to a position with the same volume, but in the opposite direction. SL and TP are more of an interface feature that allows you to keep pending orders associated with a position, rather than a specific trading instruction. Therefore we do not plan to make this feature a parts of FIX API. Instead, it is advised to implement SL and TP on your side by opening a stop loss order and, a limit order linked to a position with the same volume and the opposite direction. "
You will need to handle these orders independently.
Best Regards,
Panagiotis
@PanagiotisCharalampous
khezrian
24 Feb 2022, 14:11
Automatic cancellation of Pending Orders Limit and Stop
Hi,
Based on the issues raised in this post, and since T/P and S/L cannot be determined directly through the FIX API, it should be done as Limit and Stop by creating a new order contrary to the original position.
These Limit and Stop orders are placed in the order list as Pending Order.
PositionID value (or tag 721) is sent when registering Limit and Stop orders.
We have two problems:
1- If the main position is closed by any of the Limit or Stop orders, the other order will remain in the Pending Order list.
Question: How can this be done automatically? , Ie if the main position is closed by Pending Order Limit, Pending Order Stop is automatically deleted (deleted or closed) and vice versa, if the main position is closed by Pending Order Stop, Pending Order Limit is automatically deleted (deleted) Or be closed).
2- If the main position is closed manually through any platform (for example, cTrader), the two orders created Limit and Stop will remain in the order list.
Since we send tag 721, which is PositionID, when creating Limit and Stop orders, we expect these Pending Orders to be removed as the main position closes.
I know that I can report the status of the position using (MsgType(35)=AP) and I also know that I can cancel an order using (MsgType(35)=F).
I'm looking for a solution, after applying one of the Pending Order Limit or Stop, Another Pending Order is automatically canceled.
Please advise what should be done in this regard.
@khezrian
PanagiotisCharalampous
24 Feb 2022, 14:18
Hi khezrian,
There is no automatic solution for this. You need to handle these scenarios yourself.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
massimiliano.quarti
24 Jun 2022, 17:57
721 not working
Hi, i have a question about fix api. I found in the forum that you noticed passing field 721 to correlate orders in hedging account, so you have a position and an order as SL correlated with that position that closes all the order and positio at sl level. I tried all the day to pass 721 in various way but there is no correlation at all, have you some example of usage?
@massimiliano.quarti
PanagiotisCharalampous
27 Jun 2022, 12:16
Hi massimiliano.quarti,
Can you provide examples of what you are doing and it doesn't work e.g the messages you are sending and some evidence that it does not work?
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
massimiliano.quarti
20 Jul 2022, 11:03
( Updated at: 20 Jul 2022, 11:12 )
RE:
PanagiotisCharalampous said:
Hi massimiliano.quarti,
Can you provide examples of what you are doing and it doesn't work e.g the messages you are sending and some evidence that it does not work?
Best Regards,
Panagiotis
here ther is my code that tries to open position to different account on the opening position event. I try to get the 721 returned when i open the position to the different account and pass it to the orders that should be work as stop loss passing the same 721 field private void OnPositionsOnOpened(PositionOpenedEventArgs args) { Position pos = args.Position; if (ListaAccount != null) { for (int i = 0; i < ListaAccount.Count; i++) { var message = _messageConstructor[i].NewOrderSingleMessage(MessageConstructor.SessionQualifier.TRADE, _messageSequenceNumber[i], "1234567890", symbofixid, pos.TradeType == TradeType.Buy ? 1 : 2, DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss"), Convert.ToInt32(pos.Quantity), 1, "1", 0, 0, DateTime.UtcNow.AddDays(1).ToString("yyyyMMdd-HH:mm:ss"), "", "copy_" + pos.Id.ToString()); string dd = SendTradeMessage(message, _tradeStreamSSL[i], i); Print("Answer order: " + dd.ToString()); string[] aa = dd.Split('\u0001'); string orderid = ""; string orderid11 = ""; foreach (string item in aa) { if (item.StartsWith("721=")) { orderid = item.Split('=')[1]; break; } } foreach (string item in aa) { if (item.StartsWith("11=")) { orderid11 = item.Split('=')[1]; break; } } Print("orderid721 " + orderid); Print("orderid11 " + orderid11); if (pos.StopLoss != null && pos.StopLoss != 0) { if (pos.TradeType == TradeType.Buy) { var messagesl = _messageConstructor[i].NewOrderSingleMessage(MessageConstructor.SessionQualifier.TRADE, _messageSequenceNumber[i], orderid11, symbofixid, 2, DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss"), Convert.ToInt32(pos.Quantity), 3, "3", 0, Math.Round(Convert.ToDecimal(pos.StopLoss), 1), DateTime.UtcNow.AddDays(1).ToString("yyyyMMdd-HH:mm:ss"), "", "copy_" + pos.Id.ToString()); string ddsl = SendTradeMessage(messagesl, _tradeStreamSSL[i], i); Print("Answer sl: " + ddsl.ToString()); } else { var messagesl = _messageConstructor[i].NewOrderSingleMessage(MessageConstructor.SessionQualifier.TRADE, _messageSequenceNumber[i], orderid11, symbofixid, 1, DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss"), Convert.ToInt32(pos.Quantity), 3, "3", 0, Math.Round(Convert.ToDecimal(pos.StopLoss), 1), DateTime.UtcNow.AddDays(1).ToString("yyyyMMdd-HH:mm:ss"), "", "copy_" + pos.Id.ToString()); string ddsl = SendTradeMessage(messagesl, _tradeStreamSSL[i], i); Print("Answer sl: " + ddsl.ToString()); } } } } }
here the message compisition following your examples in github
public string NewOrderSingleMessage(SessionQualifier qualifier, int messageSequenceNumber, string orderID, long symbol, int side, string transactTime, int orderQuantity, int orderType, string timeInForce, decimal price = 0, decimal stopPrice = 0, string expireTime = "", string positionID = "",string label="") { var body = new StringBuilder(); //Unique identifier for the order, allocated by the client. body.Append("11=" + orderID + "|"); //Instrument identificators are provided by Spotware. body.Append("55=" + symbol + "|"); //1= Buy, 2 = Sell body.Append("54=" + side + "|"); // Client generated request time. body.Append("60=" + transactTime + "|"); //The fixed currency amount. body.Append("38=" + orderQuantity + "|"); //1 = Market, the Order will be processed by 'Immediate Or Cancel'scheme(see TimeInForce(59): IOC); //2 = Limit, the Order will be processed by 'Good Till Cancel' scheme(see TimeInForce(59): GTC). body.Append("40=" + orderType + "|"); if (price != 0) { //Reserved for future use. body.Append("44=" + price.ToString().Replace(",", ".") + "|"); } if (stopPrice != 0) { //The worst client price that the client will accept. //Required when OrdType = 2, in which case the order will notfill unless this price can be met. body.Append("99=" + stopPrice.ToString().Replace(",",".") + "|"); } // 1 = Good Till Cancel (GTC), it will be active only for Limit Orders (see OrdType(40)) ; // 3 = Immediate Or Cancel (IOC), it will be active only for Market Orders(see OrdType(40)); // 6 = Good Till Date(GTD), it will be active only if ExpireTime is defined (see ExpireTime(126)). // GTD has a high priority, so if ExpireTime is defined, GTD will be used for the Order processing. body.Append("59=" + timeInForce + "|"); if (expireTime != string.Empty) { // Expire Time in YYYYMMDDHH:MM:SS format.If is assigned then the Order will be processed by 'Good Till Date' scheme // (see TimeInForce: GTD). body.Append("126=" + expireTime + "|"); } if (positionID != string.Empty) { // Position ID, where this order should be placed. If not set, new position will be created, it’s id will be returned in ExecutionReport(8) message. body.Append("721=" + positionID + "|"); } if (label != string.Empty) { // Position ID, where this order should be placed. If not set, new position will be created, it’s id will be returned in ExecutionReport(8) message. body.Append("494=" + label + "|"); } var header = ConstructHeader(qualifier, ApplicationMessageCode(ApplicationMessageType.NewOrderSingle), messageSequenceNumber, body.ToString()); var headerAndBody = header + body; var trailer = ConstructTrailer(headerAndBody); var headerAndMessageAndTrailer = header + body + trailer; return headerAndMessageAndTrailer.Replace("|", "\u0001"); }
@massimiliano.quarti
PanagiotisCharalampous
21 Jul 2022, 10:24
Hi massimiliano.quarti,
I need the exact log of exchanged messages to understand what you are sending and what you are receiving e.g.
Request
8=FIX.4.4|9=100|35=AN|49=live.theBroker.12345|56=CSERVER|34=99|52=20170117- 10:09:54|50=any_string|57=TRADE|710=876316401|10=103|
Response
8=FIX.4.4|9=163|35=AP|34=98|49=CSERVER|50=TRADE|52=20170117-10:09:54.076|56=live.theBroker.12345|57=any_string|55=1|710=876316401|721=101|727=1|72 8=0|730=1.06671|702=1|704=0|705=30000|10=182|
Also I need some screenshots from cTrader deomnstrating that the orders have not been placed on the requested position.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
massimiliano.quarti
28 Jul 2022, 08:27
( Updated at: 21 Dec 2023, 09:22 )
RE:
PanagiotisCharalampous said:
Hi massimiliano.quarti,
I need the exact log of exchanged messages to understand what you are sending and what you are receiving e.g.
Request8=FIX.4.4|9=100|35=AN|49=live.theBroker.12345|56=CSERVER|34=99|52=20170117- 10:09:54|50=any_string|57=TRADE|710=876316401|10=103|
Response
8=FIX.4.4|9=163|35=AP|34=98|49=CSERVER|50=TRADE|52=20170117-10:09:54.076|56=live.theBroker.12345|57=any_string|55=1|710=876316401|721=101|727=1|72 8=0|730=1.06671|702=1|704=0|705=30000|10=182|Also I need some screenshots from cTrader deomnstrating that the orders have not been placed on the requested position.
Best Regards,
Panagiotis
28/07/2022 07:14:11.806 Send Order: 8=FIX.4.49=19135=D49=demo.icmarkets.829075956=cServer57=TRADE50=TRADE34=252=20220728-05:14:1211=123456789055=1004654=160=20220728-05:14:1238=140=159=1126=20220729-05:14:12494=copy_28635961910=103
28/07/2022 07:14:11.916 Answer order: 8=FIX.4.49=25235=834=249=cServer50=TRADE52=20220728-05:14:11.87956=demo.icmarkets.829075957=TRADE11=123456789014=037=44072041438=139=040=154=155=1004659=360=20220728-05:14:11.865126=20220729-05:14:12.000150=0151=1494=copy_286359619721=28635962710=159
28/07/2022 07:14:11.916 orderid721 286359627
28/07/2022 07:14:11.916 orderid11 1234567890
28/07/2022 07:14:11.916 Send SL Order: 8=FIX.4.49=19135=D49=demo.icmarkets.829075956=cServer57=TRADE50=TRADE34=252=20220728-05:14:1211=123456789055=1004654=160=20220728-05:14:1238=140=159=1126=20220729-05:14:12494=copy_28635961910=103
28/07/2022 07:14:12.010 Answer sl: 8=FIX.4.49=26335=834=349=cServer50=TRADE52=20220728-05:14:11.97956=demo.icmarkets.829075957=TRADE11=123456789014=037=44072041538=139=040=354=255=1004659=660=20220728-05:14:11.96799=13186.8126=20220729-05:14:12.000150=0151=1494=copy_286359619721=28635962810=199
here is the log of the messages printed from the robot: order sent to the destination account ,retrieved 721 and 11 fields and the sl order sent. the answers are still plotted
the screenshot are:
1. the master copier with the opened position
2. the account that received the orders with the opened position
3. the account that received the orders with the ORDER for the sl
so i don't know what is wrong but the position is not taking sl but only the order so i think the usage of 721 field is wrong but i don't understand what i have to do to fix it
@massimiliano.quarti
massimiliano.quarti
28 Jul 2022, 08:56
RE: RE:
Sorry i wrong version of the robot
the fiz api sequence is that one:
28/07/2022 07:46:43.138 | Send Order: 8=FIX.4.49=19135=D49=demo.icmarkets.829075956=cServer57=TRADE50=TRADE34=252=20220728-05:46:4311=123456789055=1004654=160=20220728-05:46:4338=140=159=1126=20220729-05:46:43494=copy_28637959210=132
28/07/2022 07:46:43.232 | Answer order: 8=FIX.4.49=25235=834=249=cServer50=TRADE52=20220728-05:46:43.18856=demo.icmarkets.829075957=TRADE11=123456789014=037=44074196238=139=040=154=155=1004659=360=20220728-05:46:43.178126=20220729-05:46:43.000150=0151=1494=copy_286379592721=28637959310=195
28/07/2022 07:46:43.232 | Send SL Order: 8=FIX.4.49=21535=D49=demo.icmarkets.829075956=cServer57=TRADE50=TRADE34=352=20220728-05:46:4311=28637959255=1004654=260=20220728-05:46:4338=140=399=13189.359=3126=20220729-05:46:43721=286379592494=copy_28637959210=047
28/07/2022 07:46:43.341 | Answer sl: 8=FIX.4.49=60235=j34=349=cServer50=TRADE52=20220728-05:46:43.28856=demo.icmarkets.829075957=TRADE58=NOT_ENOUGH_RIGHTS:NewOrderReq@408ee527[traderId=1923113,sessionId=127676037,clientRequestId=286379592,label=copy_286379592,channel=FIX,dealerReq=false,ignoreValidation=false,price=1318930000,expirationTimestamp=1659073603000,timeInForce=GOOD_TILL_DATE,volume=100,guaranteedStopLoss=false,mirroringCommissionRate=0,innerMirroringFee=true,stopTriggerMethod=TRADE,positionId=286379592,symbolId=10046,type=STOP,tradeSide=SELL,clientOrderId=286379592,checkTolerance=false,additionalChannel=[]]379=286379592380=010=142
no sl order opened only the position without sl
@massimiliano.quarti
massimiliano.quarti
05 Aug 2022, 10:01
RE: RE: RE:
Hi,
did you watched at my post?
Is possible to have a more detailed manual on fix api?
@massimiliano.quarti
PanagiotisCharalampous
05 Aug 2022, 10:18
Hi massimiliano.quarti,
We checked your messages and it seems that you are trying to modify a position that does not belong to your account.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
massimiliano.quarti
05 Aug 2022, 10:19
RE:
PanagiotisCharalampous said:
Hi massimiliano.quarti,
We checked your messages and it seems that you are trying to modify a position that does not belong to your account.
Best Regards,
Panagiotis
yes is a copier it is replicating the position to other accounts with fixapi, is right
@massimiliano.quarti
PanagiotisCharalampous
05 Aug 2022, 10:38
Hi massimiliano.quarti,
You can use FIX API only for the account that is currently logged in.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
massimiliano.quarti
05 Aug 2022, 10:42
RE:
PanagiotisCharalampous said:
Hi massimiliano.quarti,
You can use FIX API only for the account that is currently logged in.
Best Regards,
Panagiotis
but the fixapi is working, i open the positions to the different accounts, the think that is not working is the usage of 721 field to make the sl and tp orders working as an an OCO order in hedging accounts.
@massimiliano.quarti
PanagiotisCharalampous
05 Aug 2022, 10:48
Hi massimiliano.quarti,
You should not be acle to trade for a different account than the one that is logged in. If this is the case, we will investigate it and fix it.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
massimiliano.quarti
05 Aug 2022, 10:51
RE:
That is not a good news. How is possible to build a copier without that mechanism?
My client needs a copier between differents accounts, which api i have to use? Openapi has the same modality of working?
PanagiotisCharalampous said:
Hi massimiliano.quarti,
You should not be acle to trade for a different account than the one that is logged in. If this is the case, we will investigate it and fix it.
Best Regards,
Panagiotis
@massimiliano.quarti
massimiliano.quarti
05 Aug 2022, 12:52
( Updated at: 21 Dec 2023, 09:22 )
RE: RE:
That is what i'm trying to do. I think that fixapi is made to this usage from every application like you use to do in the samples in github
@massimiliano.quarti
PanagiotisCharalampous
05 Aug 2022, 14:09
Hi massimiliano.quarti,
If you need to trade on behalf of somebody else, you need to use Open API.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous
ctid5718405
07 Mar 2023, 16:12
( Updated at: 07 Mar 2023, 16:13 )
PanagiotisCharalampous said:
Hi massimiliano.quarti,
If you need to trade on behalf of somebody else, you need to use Open API.
Best Regards,
Panagiotis
I am also working a copy trading solution just similar to one described by massimiliano.quarti
My main account under a bot will create a master order, that I would like to copy to possibly thousands of my customer accounts.
How I am thinking to manage it like, designing a copy trading engine as described by massimiliano.quarti using FIX API, where I need to manage three orders first one to manage main trade, second one to manage SL, and third to manage a TP, but you suggested to use Open API instead of FIX API, but probably you know there certain limitations posed on requests per second under one Open API application
so how can I manage possibly 1000s of requests per second using Open API?
@ctid5718405
ctid5718405
17 Mar 2023, 08:27
RE:
ctid5718405 said:
PanagiotisCharalampous said:
Hi massimiliano.quarti,
If you need to trade on behalf of somebody else, you need to use Open API.
Best Regards,
Panagiotis
I am also working a copy trading solution just similar to one described by massimiliano.quarti
My main account under a bot will create a master order, that I would like to copy to possibly thousands of my customer accounts.
How I am thinking to manage it like, designing a copy trading engine as described by massimiliano.quarti using FIX API, where I need to manage three orders first one to manage main trade, second one to manage SL, and third to manage a TP, but you suggested to use Open API instead of FIX API, but probably you know there certain limitations posed on requests per second under one Open API application
so how can I manage possibly 1000s of requests per second using Open API?
After a lot of research and deliberation, I came up with a solution that can copy trade on behalf of possibly1000s of customers having their ctrader accounts, my solution is based on.
- A serverless and Microsoft Azure cloud-based application (Azure Event Grid, with Azure Functions),
- ctrader Open API
- SQL Server (In memory OLTP)
@ctid5718405
massimiliano.quarti
17 Mar 2023, 09:17
RE: RE:
Please contact me i'm still searching a valid solution
ctid5718405 said:
ctid5718405 said:
PanagiotisCharalampous said:
Hi massimiliano.quarti,
If you need to trade on behalf of somebody else, you need to use Open API.
Best Regards,
Panagiotis
I am also working a copy trading solution just similar to one described by massimiliano.quarti
My main account under a bot will create a master order, that I would like to copy to possibly thousands of my customer accounts.
How I am thinking to manage it like, designing a copy trading engine as described by massimiliano.quarti using FIX API, where I need to manage three orders first one to manage main trade, second one to manage SL, and third to manage a TP, but you suggested to use Open API instead of FIX API, but probably you know there certain limitations posed on requests per second under one Open API application
so how can I manage possibly 1000s of requests per second using Open API?
After a lot of research and deliberation, I came up with a solution that can copy trade on behalf of possibly1000s of customers having their ctrader accounts, my solution is based on.
- A serverless and Microsoft Azure cloud-based application (Azure Event Grid, with Azure Functions),
- ctrader Open API
- SQL Server (In memory OLTP)
@massimiliano.quarti
ctid5718405
17 Mar 2023, 09:50
RE: RE: RE:
massimiliano.quarti please provide your contact details
massimiliano.quarti said:
Please contact me i'm still searching a valid solution
ctid5718405 said:
ctid5718405 said:
PanagiotisCharalampous said:
Hi massimiliano.quarti,
If you need to trade on behalf of somebody else, you need to use Open API.
Best Regards,
Panagiotis
I am also working a copy trading solution just similar to one described by massimiliano.quarti
My main account under a bot will create a master order, that I would like to copy to possibly thousands of my customer accounts.
How I am thinking to manage it like, designing a copy trading engine as described by massimiliano.quarti using FIX API, where I need to manage three orders first one to manage main trade, second one to manage SL, and third to manage a TP, but you suggested to use Open API instead of FIX API, but probably you know there certain limitations posed on requests per second under one Open API application
so how can I manage possibly 1000s of requests per second using Open API?
After a lot of research and deliberation, I came up with a solution that can copy trade on behalf of possibly1000s of customers having their ctrader accounts, my solution is based on.
- A serverless and Microsoft Azure cloud-based application (Azure Event Grid, with Azure Functions),
- ctrader Open API
- SQL Server (In memory OLTP)
@ctid5718405
obaum1@gmail.com
05 Oct 2017, 23:23
Hey :)
If I understand right, If I have for the following EXAMPLE: (Buy, EURUSD, 1,000, EnterPrice 1.17852) and I want
To associated Limit Order & Stop Order I need to do the following:
TakeProft Steps:
1) Set Buy, EURUSD, 1,000, EnterPrice: 1.17852
2) Set Limit Order for Sell, 1,000, TargetPrice: 1.17952
3) When target price trigged, I have two positions that hold the profit of 10 pips
StopLoss Steps:
1) Set Buy, EURUSD, 1,000, EnterPrice: 1.17852
2) Set Stop Order for Sell, 1,000, TargetPrice: 1.17752
3) When target price trigged, I have two positions that hold the loss of 10 pips
So far I'm good?
If this is case it seems that the cost in commissions is higher then using
The Connect API which holds the option for setting position TakeProfit & StopLoss.
@obaum1@gmail.com