The opinions expressed in these forums do not represent those of C2, and any discussion of profit/loss is not indicative of future performance or success. There is a substantial risk of loss in trading. You should therefore carefully consider whether such trading is suitable for you in light of your financial condition. You should read, understand, and consider the Risk Disclosure Statement that is provided by your broker before you consider trading. Most people who trade lose money.

Implementing a Trailing Stop

I’m attempting to implement a trailing stop with an xReplace on any existing limit trades against the stock. Part of that includes calculating the price at which to put the new limit.

When using the requestAllTrades I get something similar to the below (obviously). This lacks the current price, average or not, of the stock.

Is there a way I can calculate the rough current price given the values below. Perhaps with opening_price_VWAP and PL?

{
“closeVWAP_timestamp”: “1454074721”,
“strike”: “41.5”,
“open_or_closed”: “closed”,
“expir”: “Dec15”,
“openVWAP_timestamp”: “1454074721”,
“underlying”: “CF”,
“closing_price_VWAP”: “0.00000”,
“putcall”: “put”,
“component_signals”: [
{
“symbol”: “CF1511X41.5000”,
“signalid”: “99996427”,
“action”: “STO”,
“quant”: “1”,
“instrument”: “option”,
“tradeprice”: “0.370000”,
“tradedwhen”: “2015-12-07 11:58:03”
},
{
“symbol”: “CF1511X41.5000”,
“signalid”: “99996490”,
“action”: “BTC”,
“quant”: “1”,
“instrument”: “option”,
“tradeprice”: “0.000000”,
“tradedwhen”: “2015-12-11 00:00:00”
}
],
“quant_closed”: “1”,
“markToMarket_time”: “”,
“opening_price_VWAP”: “0.37000”,
“trade_id”: “99996428”,
“symbol”: “CF1511X41.5000”,
“quant_opened”: “1”,
“closedWhen”: “2015-12-11 00:00:00”,
“instrument”: “option”,
“ptValue”: “100”,
“PL”: “37”,
“closedWhenUnixTimeStamp”: “1449810000”,
“openedWhen”: “2015-12-07 11:58:03”,
“long_or_short”: “short”,
“symbol_description”: null
}

I figured it out. It’s the following:

((PL / opening_price_VWAP) / quant_opened) + opening_price_VWAP

Back to C2 Platform