Our plans and pricing are changing on 1st November. Learn more...

Automated Trading Iceberg Order


side, totalAmount, averageAmount, variance, limitPrice, timeLimit, reduceOnly, tag

An algorithmic order that breaks up a large order into smaller orders. This is often also called the Accumulate / Distribute order.

The small orders are placed relative to the current price, but only if the current price is below/above a set limit price. The system waits for the small order to fill and when it does, places the next order. If the price slips too far, the order is cancelled and re-entered. This implementation attempts to work in the same way as the okex iceberg order.

This order can be cancelled using either cancel() or by cancelling the current limit order on the exchange.

Some exchanges refer to 'Iceberg Order' as an order that is partially hidden, but this is not that kind of order.

side required text, one of buy, sell. defaults to buy

Is this a buy or sell order.
Required if you don't use position.

totalAmount required number, defaults to 0

The total amount to buy or sell.

averageAmount required number, defaults to 0

The amount for each of the small sub-orders. The actual amount of each individual limit order will be this value +-10%.

variance required percentage, defaults to 0.1%

How far away from the current price should each of the smaller orders be placed.

limitPrice required number,

When buying, the bid price must be below the limit price. When selling, the ask price must be above the limit price.

While the price is the wrong side of the limit price, the iceberg order will be suspended - no new orders will be placed. When the price crosses back, then ordering will continue until totalAmount has been filled.

timeLimit optional time string,

The amount of time to leave the order running before giving up. If the time limit is reached, the command stops and any unfilled quantity will be left unfilled.
If this argument is missing, there will be no time limit and the order will run until it is fully filled or cancelled.

Duration How long will it wait?
timeLimit=10 10 seconds
timeLimit=10s Also 10 seconds
timeLimit=10m 10 minutes
timeLimit=10h 10 hours
reduceOnly optional boolean, one of true, false. defaults to false

Attempt to submit the order as a reduce-only order. This is ignored in any spot markets / exchanges, as there is no concept of an open position there.

tag optional string, defaults to varies by order type

Applies a tag to an order that can later be used to cancel this order, even from a different session. Many orders can be given the same tag, making it possible to cancel them all as a group at a later date. These tags can be referenced by the cancel() command to cancel specific named orders. See cancel() with which=taggedfor more details.

Example: Buy 100 contracts using only limit orders.

myApiKeys(XBTUSD) {
    iceberg(side=buy, totalAmount=1000, 
        averageAmount=50, variance=0.1%, limitPrice=10000, timeLimit=12h);

While the price is below $10,000 (limitPrice), place an order of 50 contracts (+- 10%), 0.1% below the current price and wait for it to fill. Once filled, place a new order 0.1% below the current price. Repeat this until a total of 1000 contracts has been filled or 12 hours have passed. If the price rises more than 0.2% while waiting for an order to fill, move the order so it is 0.1% below the current price again. If at any time the price goes above $10,000, then stop placing orders and do nothing until it goes below $10,000 again.

Buy the Dip!

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.


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.