Alerts from an indicator or your own code
Naming the instruction yourself: the verbs, a message builder, and the advanced controls — partial closes, trailing stops, ATR stops and one-message reversals.
When the alert comes from an indicator, TrendSpider, or your own code, nothing on the other side knows whether you are in a trade. So you say exactly what to do. That is all this page is: how to say it.
New here? Sending messages to Nixora covers where your webhook address lives and the two switches that must be on before anything trades.
Copy one of these to start
An indicator does not know whether you are in a trade, so you need one alert to buy and another to sell.
{"action":"open","side":"buy","symbol":"{{ticker}}","vol_lots":0.10}
Same message — TrendSpider fills its own placeholders before it sends.
{"action":"open","side":"buy","symbol":"%alert_symbol%","vol_lots":0.10}
Anything that can POST JSON works. Put your webhook address in the URL.
curl -X POST https://hook.nixoratrade.com/h/YOUR_TOKEN \
-H "Content-Type: application/json" \
-d '{"action":"open","side":"buy","symbol":"EURUSD","vol_lots":0.10}'
Build your own
Build your message
Choose what you want. The message updates as you type — copy it into your alert, or copy the Pine line into your script.
…
…
Two options there are worth switching on:
- Label puts your own name on the order, so
london-fvgshows up beside it in the Journal. idstamps each alert with a short unique key, so a repeat of the same alert can be recognised. Retries using the same immutable command ID are deduplicated within the supported retention window. That is retry deduplication, not an exactly-once promise, and it is not identical on every kind of account: on a NixoraPaper account the key is remembered for 30 days, and after that the same key is a new command. Leave it on, make it change with every real signal, and keep it under 28 characters using only letters, digits and_ . : -(for examplelfvg-{{time}}). On live accounts the rule is different. Without an explicit ID, duplicate protection may cover only alerts received in the same clock second. Always send a short unique ID. (Retries, duplicates and command ids).
The same generator, with more options, is in the app under Auto Trading → Syntax & Builder.
The shape of a message
{"action":"open","side":"buy","symbol":"EURUSD","vol_lots":0.5}
The thing to memorise: the verb is action, and the direction is a separate field, side. Opening
is open plus a side; the other verbs are for closing and managing what is already there. The short
forms buy and sell also work and mean exactly the same thing.
The everyday verbs
Opening
{"action":"open","side":"buy","symbol":"EURUSD","vol_lots":0.5}
To rest an order at a price instead of buying now, add orderType and price:
{"action":"open","side":"buy","symbol":"EURUSD","orderType":"limit","price":1.0750}
Getting out
closelong— closes your longs in that symbolcloseshort— closes your shortscloselongshort— closes both directions, leaving waiting orders alonecloseall— closes both directions and cancels the waiting orders
{"action":"closelong","symbol":"EURUSD"}
The last two differ in one thing only: whether orders that have not filled yet are cancelled too.
Changing what is already there
modifylong/modifyshort— move the stops on open tradescancellong/cancelshort— cancel orders still waiting
{"action":"modifylong","symbol":"EURUSD","sl_price":1.0820}
Only the fields you include change. Leave tp_price out and your target stays where it is.
Stopping the account
eaoff— stop executing; open trades are left aloneeaon— start againclosealleaoff— close everything, then stop
{"action":"eaoff"}
eaoff is the one to wire to a "something is wrong" condition: it prevents new damage without
closing positions you may want to handle yourself.
Beyond the basics
Everything below is optional. Skip it until you need it.
Closing part of a position
closelongpct/closeshortpct— close a percentagecloselongvol/closeshortvol— close an exact number of lots
{"action":"closelongpct","symbol":"EURUSD","close_pct":50}
Watch the unit. On the pct verbs the number is a percentage: 50 is half the position, not fifty
lots. Percentages travel well when one alert feeds several accounts; a fixed lot size does not.
Turning a position around in one message
closelongopenshort/closeshortopenlong— close, then enter the other waycloselongopenlong/closeshortopenshort— close and re-enter the same waycloselongshortopenlong/closelongshortopenshort— clear both sides first, then enter
{"action":"closelongopenshort","symbol":"EURUSD","vol_lots":0.5}
Read the names left to right and they say what they do. They exist as one verb so the turn is a single instruction — two separate alerts can arrive out of order and leave you the wrong way round.
Its shorthand also works: cl+ol, cl+os, cs+ol, cs+os, cls+ol, cls+os.
Coming from PineConnector
Keep your alerts and change only the webhook URL. The text form works as it is:
123456789,buy,EURUSD,vol_lots=0.5,sl_pips=20
The first field is ignored, because the secret key in your webhook URL is what identifies you. You can also leave it out:
buy,EURUSD,vol_lots=0.5,sl_pips=20
If you leave it out and your symbol is named like a command (for example BULL), the alert is refused, because
two commands in a row can't be read safely. Put any first field in front: 1,buy,BULL,vol_lots=1. The verbs
buy, sell, long, short, bull, bear, buylimit, buystop, selllimit, sellstop, newsltplong,
newsltpshort, cancellongbuystop, cancellongbuylimit, cancelshortsellstop and cancelshortselllimit
all work, in the text form and in JSON.
Four things to check:
- In the text form, 1 pip is 10 points on every symbol, as in PineConnector. In JSON, 1 pip stays what it has always been here: 10 points on a 3- or 5-digit price, 1 point otherwise. On gold that is a factor of ten.
- The old
sl=,tp=,risk=andpending=depend on PineConnector's EA settings, so the text form refuses them and names what to send instead:sl_pips,sl_price,sl_pct,vol_lots,entry_price. comment=labels an entry in your Journal. A close or cancel carryingcomment=is refused, because closing only the orders with one comment is not available on this webhook. Use a strategy subscription.closeallin the text form closes every position and cancels every pending order on the account. In JSON it closes one symbol, unless you add"scope":"account".
sl=0 (move the stop to breakeven now), accfilter=, a trailtrig of 0 or less, account-wide closeall,
text-form pips and a closelongpct with no percentage need MT5 EA 2.34 or MT4 EA 1.80. The account filter checks
the EA's Account Filter Basis setting and skips an entry below your number. A closelongpct with no percentage
uses the EA's Default Partial Close setting. Until those EAs are released these alerts are refused by name.
Placing a waiting order with its stops attached
newsltpbuylimit·newsltpbuystop·newsltpselllimit·newsltpsellstop
{"action":"newsltpbuylimit","symbol":"EURUSD","price":1.0750,"sl_price":1.0700,"tp_price":1.0900}
Read the name as new · sl/tp · buy · limit. The point is that the order and its protection arrive together — an order placed first and protected afterwards is unprotected in between.
Sizing by risk instead of lots
A fixed lot size is too big on one account and trivial on another. These size to the account:
{"action":"open","side":"buy","symbol":"EURUSD","vol_pct_eq_loss":1,"sl_pips":20}
That risks 1% of equity, worked out from the stop — so it needs a stop to measure against.
Stops that manage themselves
Set these at entry and the EA runs them; no follow-up alert is needed.
{"action":"open","side":"buy","symbol":"EURUSD","vol_lots":0.5,"sl_pips":20,"betrigger":10,"beoffset":1}
That moves the stop to break-even once the trade is 10 pips up. There are trailing-stop and ATR-trailing equivalents, all listed in the Keyword reference.
On an Alpaca account
Alpaca takes the same messages, in shares and on US stocks. There is no Expert Advisor there, so NixoraTrade works out each calculated value once when the alert arrives.
{"action":"open","side":"buy","symbol":"AAPL","vol_dollar":100,"sl_pct":2,"tp_pct":4}
- Stops, targets and entries can be a price,
_pctor_pips. On a stock, 1 pip is $0.01 in a JSON message and $0.10 in PineConnector's comma format. - Sizing with
vol_dollar,vol_pct_eq_loss,vol_pct_bal_loss,vol_pct_bal_marginorriskalways rounds down to whole shares. A size that rounds to zero is refused. Alpaca has no balance figure, so "balance" means the account's equity at the previous close. spreadrefuses the entry if the quote is too wide or has no usable bid and ask.accfilterrefuses the entry if equity is below your number.
To change a stop or target on an open position, use modifylong or modifyshort. "sl":0 moves the stop to your average entry.
{"action":"modifylong","symbol":"AAPL","sl_pct":2}
If nothing is resting, this places one protective order for the shares you hold. If a stop is resting but no target, a target is refused, because Alpaca holds the shares on the stop. Stops belonging to a strategy subscription are left alone.
newsltpbuystop, newsltpbuylimit, newsltpsellstop and newsltpselllimit change the stop and target of resting orders from this webhook, if the order was placed with them.
Not available on Alpaca: automatic breakeven, trailing stops and ATR trailing, because something would have to watch the position after entry. These are refused, never ignored.
On a Binance account
Binance takes JSON messages only, not PineConnector's comma format. Each alert must state qty, a stop and a target, and carry the alert's time; add an id too, to name the alert. An id without a time is refused, because the age of the alert cannot be checked.
{"action":"open","side":"buy","symbol":"BTCUSDT","qty":"0.01","sl_price":"90000","tp_price":"110000","id":"a1","time":"{{timenow}}"}
qtyis the contract quantity.vol_lots,lotsand the risk-based sizes are refused, because a lot is not a contract quantity here.- Entries:
buy,sell,long,short,bull,bearandopenwithsideare market orders.buylimitandselllimit, ororderTypeset tolimitwithpriceorentry_price, rest as limit orders. Stop entries are refused. - Stops and targets are prices:
slorsl_price,tportp_price. Pips and % are refused. - Exits:
close,flat,exitandcloselongshortclose the active order on the symbol.closelongonly closes a long, andcloseshortonly closes a short.
Anything else from this guide, such as spread, accfilter, trailing or partial closes, is refused by name, never ignored.
Working on one specific order
Three verbs take a ticket — close, modify and cancel — and act on that one order alone.
{"action":"close","ticket":148302,"vol_lots":0.01}
{"action":"modify","ticket":148302,"sl_price":1.0820}
{"action":"cancel","ticket":148302}
A ticket is the number your broker gave that one order, so these only work on your account address — see How alerts are routed.
Writing a note instead of trading
alert records a line in the Journal and places nothing — useful for marking a session open or a
change in conditions, so the Journal reads as a story rather than a list of fills.
{"action":"alert","symbol":"EURUSD","ref":"london-open"}
When something is refused
A refusal is not silence. It is recorded against the alert that caused it, with the reason in plain words, next to the accepted orders in the Journal.
The habit worth forming: when an alert does not do what you expected, read the refusal before changing the alert. It usually names the fix.
Everything in one place
Every verb and every parameter, with what it does and an example, is in the Keyword reference.