New Style of Trailing Orders Now Available

16 July 2020

Alertatron's automated trading service has now added support for a new style of trailing orders. We have extended our existing trailing stop orders and trailing take profit orders to support alternative methods of trailing...

The existing trailing method used the traditional trailing order approach, moving the order each time a new price high is reached, maintaining a consistent offset from the best recorded price to the stop order.

We now support a stepped method of trailing that gives traders control over the movement of the stop order. It's now possible to provide a step size with the trailing stop order and trailing take profit order.

As before, the bot will position the order at some offset from the price when starting. However, the price will have to move an additional step size away from the order before it will move. At this point, it will jump up by the step size.

Example

Let's assume a trailing stop loss order is placed at an offset of $100 below the entry price, with a step size of $10. The entry price is $9,000, so the order is initially placed at $8,900.

The order will wait patiently at $8,900 until the price pushes up to $9,010, which is $10 up (the step size in this example). The order will then be moved from $8,900 to $8,910, jumping up $10.

This behaviour will continue, moving the order in $10 steps each time the price pushes up another $10. So it will move to $8,920 when the price hits $9,020, and so on.

This brings us to the second option for the stepped trailing method. It's also possible to control exactly how many times you will allow the order to move. The default will allow it to move as many times as it likes, but by setting the max steps, you can limit the bot to a finite number of steps.

How might this be useful? Good question. Lets consider another example...

Move to Breakeven

Lets assume our order starts $100 below the price, like before. This time, we'll set the step size to $100 and the max steps to 1 (so the order can only be moved a single time).

Again, the price starts at $9,000 and the order at $8,900. Now nothing will happen until the price reaches $9,100, at which point the order will jump up $100 to $9,000 (the breakeven price). Since the order can only move once, it will not move again and wait to be triggered (if the price falls back) or cancelled.

The new options are available on both the trailing stop order and the trailing take profit order. We hope this will be another useful too for traders looking to automate for profit and opens up many new ways to manage risk that are not available without tools like Alertatron.

We document the new options in the command reference. See trailing stop order and trailing take profit order for more.

Want to see an example script using the new options? Here's one that places an order, sets a stop loss order and 2 take profit orders. The stop moves to break even when the first take profit is reached.

myApiKeys(BTCUSD) {
    # Go long using 50% of my balance
    market(side=buy, amount=50%);

    # Add a stop loss 1% away that moves to breakeven at TP1
    trailingStop(side=sell, amount=100%p, offset=1%, trigger=last,
            trailingMethod=stepped, stepSize=1%, maxSteps=1);

    # Take profit 1 (1% up)
    limit(side=sell, amount=50%p, offset=e1%, reduceOnly=true);

    # Take profit 2 (2% up)
    limit(side=sell, amount=50%p, offset=e2%, reduceOnly=true);
}

A full explanation of this script can be found in our common examples help guide.

Other recent blog posts...

Alertatron Blog

Alertatron updates from June...

Time for some quick updates on recent improvements to Alertatron...

Alertatron Blog

Deribit now even faster

Deribit has always been one of our fastest integrations, but we've made some improvements and it's now even faster.

Back to the blog

Some images from Unsplash

About Alertatron.com

Your TradingView alerts, with automated trading, with charts, PM'd to you.
Auto-trade on any alert.

Automate Trading

Trigger orders on popular cryptocurrency exchanges and trade 24/7. Access powerful algorithmic orders to maximise your profits.

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.

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.