Automated trading updates: Testing PnL and Market Maker

15 October 2019

There are a couple of new updates to the automated trading bot, including new tests for continue and stop, and some big improvements to the market maker.

Testing PnL

You've always been able to make decisions in order execution blocks using the continue() and stop() commands.

Today I've added some new tests based on your current unrealised profit and loss. If you are trading on a margin exchange, like BitMEX or Deribit, then you can now test if your current position is in profit, in loss, or flat (not in profit or loss).

You use it in the same way as before. For example, if you wanted to close your position, but only if you are in profit, you can do something like this...

myApiKeys(XBTUSD) {
    continue(if=positionInProfit);
    market(position=0);
}

The new options are...

  • positionInProfit - true if you are in profit.
  • positionInLoss - true if you are in a loss.
  • positionIsFlat - true if your PnL is basically zero.

New market maker order

The market maker has been re-written to use some of the new capabilities inside the trading bot. This has resulted in it being much faster to react to changes and gaining a few options. It also now runs in the background.

For the most part it looks basically the same as the previous version, but you may notice some actions happening more quickly than in the past, such as detecting filled orders and replacing them.

There is also a new autoBalance option, though it's not recommended for most traders, as you'd need to keep a very close eye on your position size. The new center option (UK and US spellings are supported) will constantly keep the same number of orders on the bid and ask size, regardless of price movement.

Updated commands in this release

All these updates are available now - you'll need to manually update your trading bot to upgrade though. To do this, go to your bot settings (where you add the API keys), switch to the Logs tab and press 'restart'...

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.