olegchubukov's avatar
Oleg
Oleg 's avatar

Info

Username:olegchubukov
Name:Oleg
Member since: 23 Aug 2019

About

None

Signature

None

Last Forum Posts

@Getting new portion event with takeprofit and stoploss in one event:  17 Sep 2021, 10:18


amusleh said:

Hi,

The response for order filled contains both relative stop loss and relative take profit, here is an actual response for order filled Type:

{
   {
      "ctidTraderAccountId":"532255",
      "executionType":"ORDER_FILLED",
      "position":{
         "positionId":"239668487",
         "tradeData":{
            "symbolId":"1",
            "volume":"100000",
            "tradeSide":"BUY",
            "openTimestamp":"1631861204356",
            "guaranteedStopLoss":false
         },
         "positionStatus":"POSITION_STATUS_OPEN",
         "swap":"0",
         "price":1.1774,
         "utcLastUpdateTimestamp":"1631861204356",
         "commission":"-4",
         "marginRate":1.1774,
         "mirroringCommission":"0",
         "guaranteedStopLoss":false,
         "usedMargin":"235",
         "moneyDigits":2
      },
      "order":{
         "orderId":"359826732",
         "tradeData":{
            "symbolId":"1",
            "volume":"100000",
            "tradeSide":"BUY",
            "openTimestamp":"1631861204118",
            "guaranteedStopLoss":false
         },
         "orderType":"MARKET",
         "orderStatus":"ORDER_STATUS_FILLED",
         "executionPrice":1.1774,
         "executedVolume":"100000",
         "utcLastUpdateTimestamp":"1631861204356",
         "closingOrder":false,
         "clientOrderId":"ctd-1fa7f52eaa5946f0a79b1f18ec6b413d",
         "timeInForce":"IMMEDIATE_OR_CANCEL",
         "positionId":"239668487",
         "relativeStopLoss":"150",
         "relativeTakeProfit":"150",
         "trailingStopLoss":false
      },
      "deal":{
         "dealId":"330052413",
         "orderId":"359826732",
         "positionId":"239668487",
         "volume":"100000",
         "filledVolume":"100000",
         "symbolId":"1",
         "createTimestamp":"1631861204118",
         "executionTimestamp":"1631861204356",
         "utcLastUpdateTimestamp":"1631861204356",
         "executionPrice":1.1774,
         "tradeSide":"BUY",
         "dealStatus":"FILLED",
         "marginRate":1.1774,
         "commission":"-4",
         "baseToUsdConversionRate":1.1774,
         "moneyDigits":2
      },
      "isServerEvent":false
   }
}

You see the order has two fields, one for relative stop loss and another for relative take profit.

Oh, those ones! Great! A bit math and here we go. Didn't get that those numbers were points, not pips. Thank you!

@Getting new portion event with takeprofit and stoploss in one event:  17 Sep 2021, 09:21


amusleh said:

Try to use Execution event when the type is either OrderFilled or OrderPartialFill, those response types will have stop loss and take profit of the filled order (position).

That's exactly the problem. Stoplosses and takeprofits do not come in the ORDER_FILLED event, but in ORDER_ACCEPTED event under order type STOP_LOSS_TAKE_PROFIT.

@Getting new portion event with takeprofit and stoploss in one event:  15 Sep 2021, 11:14


Hey there!

As long as I know two events are sent when opening a new order with a takeprofit and stoploss in cTrader terminal.

I am going to forward new orders/positions to mt4 terminal. This means I have to make to calls to mt4 as well.

Is there a way or a known workaround of getting new position notifications with takeprofit and stoploss in one event from cTrader?

Thanks

Oleg

@Get StopLoss and TakeProfit for Deals:  13 Sep 2021, 10:59


PanagiotisCharalampous said:

Hi olegchubukov,

Closed trades have nothing to do with historical orders. They can be retrieved using ProtoOADealListReq

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Well, that's what I tried before I asked and got nothing in the deals field. Tried for accountId: 22723160, accountNumber: 3561073

The request is to pick up deals 10 days back from now

Result. Deals lsit is empty

Positions in cTrader

@Get StopLoss and TakeProfit for Deals:  13 Sep 2021, 10:13


PanagiotisCharalampous said:

Hi olegchubukov,

No you cannot retrieve historical orders. What kind of statistics would you like to calculate that require you retrieve historical orders?

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

For example, create a list with closed trades showing close time, pips and so on.

10.09.2021 09:19:58 #NZDJPY -66 PIPs
11.09.2021 09:21:47 #EURJPY +38 PIPs
12.09.2021 10:26:44 #EURJPY +20 PIPs
13.09.2021 10:50:52 #NZDUSD +20 PIPs
14.09.2021 15:17:52 #EURJPY 0 PIPs

@Get StopLoss and TakeProfit for Deals:  11 Sep 2021, 21:46


PanagiotisCharalampous said:

Hi BenjaminR,

Historical orders are not available via the Open API. You can only retrieve the pending orders.

Best Regards,

Panagiotis 

Join us on Telegram

Hi, Panagiotis

Is this still true that there is no way to retrieve historical orders?

How can I then calculate statistic for a certain period?

@Calculating P/L:  09 Sep 2021, 15:05


amusleh said:

Hi,

Before sending a ProtoOANewOrderReq/ProtoOAClosePositionReq you must be subscribed to ProtoOAExecutionEvent, there is no individual response messages for trading requests, everything related to trading operations will go to the ProtoOAExecutionEvent.

When you receive a ProtoOAExecutionEvent you can check the deal field, this filed is of type ProtoOADeal which has the executionPrice of close price.

For more information regarding closed position you can use the ProtoOADeal closePositionDetail field.

Regarding calculation of P/L, once you got the position volume, entry and close price, you have to calculate each symbol tick value to calculate a position P/L.

You can check our new WPF trading UI Demo, the sample has all these features.

For a tutorial you can check our new documentation symbol data tutorial.

Hi! GitHub url for WPF trading UI Demo, is not found.

@Not able to login to spotware:  26 Aug 2019, 11:48


It works now.

@Not able to login to spotware:  23 Aug 2019, 17:03


Hi!

I am trying to login to Open API at https://connect.spotware.com, but get a blank page with  "Whoops, looks like something went wrong.".

Password should be correct as I have reseted it and able to login at ctrader page.

CAN ANYON–£ WHO IS READING THIS TRY TO LOG IN AND GIVE A FEEDBACK IF THEY EXPERIENCE THE SAME PLEASE?

Any ideas what is going on with spotware?

Best regards

Oleg

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.

No uploaded.

Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.

No uploaded.