Automated Trading Limit Order
limit()
side, amount, offset, postOnly, reduceOnly, position, tag
Places a standard limit order. The command will finish as soon as the limit order has been placed on the exchange. It will not wait for the order to be filled.
Arguments
side
required
text, one of
buy , sell .
defaults to buy
Is this a |
||||||||||||||||||||
amount
required
number, defaults to
0
The size of the order. The units depend on the symbol and exchange. Can be given as an absolute amount, percentage of your balance or percentage of your available balance.
Percentage amounts are supported on all exchanges. On BitMEX they are supported on most (but not all) symbols. XBTUSD is supported and all symbols against XBT (eg ETHXBT), but not on symbols backed against other currencies (eg ETHUSD, XBTJPY etc can not use % amounts and must use fixed amounts - this is because we need live price information for additional symbols to complete the calculation, which are not tracked to by default). Required if you don't use position. |
||||||||||||||||||||
offset
required
number, defaults to
0
Calculates the price as an offset from the current live price. For an asset quoted in USD (eg BTCUSD), offset can be given in the following ways:-
|
||||||||||||||||||||
postOnly
optional
boolean, one of
true , false .
defaults to true
Attempt to submit the order as a post-only order. Post only orders behave differently between exchanges...
|
||||||||||||||||||||
reduceOnly
optional
boolean, one of
true , false .
defaults to false
Attempt to submit the order as a reduce-only order. Only supported on BitMEX and Deribit. |
||||||||||||||||||||
position
optional
number,
An alternative way to calculate the side and amount for the order. The amount traded will be the difference between your current open position and the target position size. For example, if your current position is 100 contracts long, and you request a target position of 300, then an order will be placed to buy 200 contracts (the difference between your current position and target position). In fact, regardless of your current position (long, short, nothing), the order will be whatever size it needs to be to ensure you finish with an open position of the target size. Some more examples...
On spot exchanges, like Bitfinex, the target amount represents the amount of the asset you'd like to end up with. For example, on the BTCUSD pair, position would represent the amount of BTC you'd like to own after the order completes. Required if you don't use side and amount. |
||||||||||||||||||||
tag
optional
boolean, one of
true , false .
defaults to false
Tags the order with the value given. This allows you can cancel the order using it's tag. See |
Example: Place an order to buy 1000 contracts
myApiKeys(XBTUSD) {
limit(side=buy, amount=1000, offset=10);
}
Places a single order to buy 1000 contracts of XBTUSD (assumes myApiKeys are keys for BitMEX). The order will be placed $10 below the current live price, due to the offset=10 argument. As soon as the order has been submitted, the bot will disconnect without waiting for it to be filled.
Example: Change my open position size to -500 contracts
myApiKeys(XBTUSD) {
limit(position=-500, offset=10);
}
This time the order is using position. The bot will calculate the size of order needed to change your open position from it's current size (long or short), to -500 contracts (or 500 contracts short). Once the required size has been calculated, the order is placed $10 away from the current price and left for the market to fill.
Example: Take profit if price rises 3% from here
myApiKeys(XBTUSD) {
limit(side=sell, amount=1000, offset=3%, reduceOnly=true);
}
Places a limit order to sell 1000 contracts 3% above the current price. The order will be set to 'reduce only', so it will only make your position smaller.
Some images from Unsplash
About Alertatron.com
Your TradingView alerts, with charts, PM'd to you.
Get all your alerts from TradingView, sent to Telegram, Discord, Slack, Email or webhooks, with a chart snapshot attached.
Capture Charts
See a high quality chart with every alert, captured at the moment the alert was triggered. See exactly what the market was doing and make informed decisions.
Automate Trading
Trigger orders on popular cryptocurrency exchanges and trade 24/7. Access powerful algorithmic orders to maximise your profits.
Integrations
Connect your alerts to Telegram (channels, groups and private chats), Discord, Slack, email or send push notifications to other services with webhooks.
Easy To Setup
Nothing to install and no browser extensions. Captures alerts 24/7, even with your computer switched off. Be up and running in seconds.