OANDA pb= and fpb=: set the worst fill price
A market order on OANDA fills at whatever price is there when it arrives. If the market jumps in the second between your alert and the fill, you take the jump. OANDA lets an order carry a price bound, the worst price it may be filled at. In Autoview you set it with fpb= or pb=.
This page comes from the Autoview integrations code that runs on our servers today and from OANDA's v20 API reference. We read the code; we did not place live OANDA orders for this guide.
fpb= is a price, pb= is a distance
| Key | What Autoview sends as the price bound |
|---|---|
fpb=1.0850 | 1.0850, exactly as written. |
pb=0.0005 | The reference price plus 0.0005. |
pb=-0.0005 | The reference price minus 0.0005. |
pb=0.1% | The reference price plus 0.1% of it. |
Autoview adds pb= to the reference as you wrote it, sign included. It does not flip the sign for a sell. A buy bound sits above the price, so it takes a positive pb=. A sell bound sits below the price, so it takes a negative one.
What pb= is measured from
The reference is price= when your line has one. Use price={{close}} in a TradingView alert to tie it to the bar's close. Without price=, Autoview reads OANDA's current quote for the instrument:
- Market buy: the ask.
- Market sell: the bid.
That quote is read when Autoview receives the alert, so a bound of pb=0.0005 on a market buy means "no more than 0.0005 above the ask I saw."
Examples
e=OANDA s=EUR_USD b=buy t=market q=1000 pb=0.0005 d=1A market buy of 1,000 units, bounded 0.0005 above the current ask. Nothing is sent while d=1 is on the line.
e=OANDA s=EUR_USD b=sell t=market q=1000 fpb=1.0820 d=1A market sell that OANDA may not fill below 1.0820.
Stop entries take a bound too
fpx= or px= turns the order into an OANDA stop entry, and pb= rides along on it. OANDA describes the bound on a stop as the worst market price that may be used to fill it, and says that if the market gaps through both the stop price and the bound, the stop order is cancelled.
e=OANDA s=EUR_USD b=buy t=market q=1000 fpx=1.0900 fpb=1.0910 d=1A buy stop that arms at 1.0900 and may not fill above 1.0910. Use fpb= here. A relative pb= is still measured from price= or the current quote, not from your stop price, so on a stop that sits far from the market it lands somewhere you did not intend.
Limit orders
Autoview sends the bound whatever the order type, but OANDA's limit order request has no price bound field. A limit price already caps the fill, so leave pb= and fpb= off limit orders.
Lines with & sections
Autoview sets the bound once for the line. Every order the line places through & sections carries that same bound.
Which connections read pb=
OANDA only. No other connection reads it. For the rest of what OANDA reads, see the OANDA command reference.