What's New With Trade Unafraid

A couple of new features...

Computed Targets

When you call the webhook (whether from TradingView or from your own code), you can now include an array of targets within the payload, like so.

"targets":[{"price":101"qtyPct":0.1},{"price":102"qtyPct":0.1},{"price":103"qtyPct":0.1}],

Price is the price of the underlying, so you'll take those profits when the price of the stock or ETF reaches that level, whether you're in shares or options.  Of course, the rest of the Trade Plan is still at work, so be sure to coordinate what you include in the webhook with the Trade Plan Template you specify.

qtyPct is a percentage expressed as a decimal, so 0.1 is 10% of your position.

As with all targets in Trade Unafraid, we try to exit something at every target, so if your entire position is one contract, that first 10% target will "round" up to 1, and you'll be flat.  We will compute the percentage to the best of our ability, but targets should always perform some exit.  If the position is too small to accommodate the percentage specified, then the target might be your full position.  Something to keep in mind.

Returned Trade Plan ID

When you successfully open a Trade Plan via a webhook, the response will contain the tradePlanId.  (If you do this in TradingView, you'll never see that response.  But if you make the call from your own code, this might be of interest.)  Here is a sample response, with the ID at the bottom:

{
    "secret""not_for_public_distribution",
    "symbol""SPY",
    "direction""long",
    "stop""446",
    "targets": [
        {
            "price"447.0,
            "qtyPct"0.1
        },
        {
            "price"447.50,
            "qtyPct"0.1
        },
        {
            "price"447.90,
            "qtyPct"0.1
        }
    ],
    "tradePlanTemplate""myWebHookTP v1",
    "dteMin"1,
    "dteMax"7,
    "message"null,
    "id""1691354040000"
}

Why do you care about the ID?  Because you can now use it to programmatically flatten your position!

Just POST to http://<YOUR_TU_SERVER_URL>/tradePlans/{tradePlanId}/flatten, replacing {tradePlanId} with the ID you received, and the position will be flattened.

The body of the POST needs to include the same "secret" parameter in order to get past the bouncers.

Stay tuned for more...

Comments