Make a “Ping Pong” Crypto Swing Trading Bot with Coygo

Evan Francis
Coygo Blog
Published in
8 min readSep 27, 2022

Crypto markets are popular with day traders due to their volatility. With every price change an opportunity arises to make a profit. As a result, swing trading in particular has become an increasingly popular trading strategy.

As we’ve developed Coygo Bots, our crypto trading bot platform, we’ve had constant requests for more strategies that support swing trading. First we built our “Spot grid swing trader” strategy that use the popular Grid Trading approach (which you can learn about here: Make a Crypto Swing Trading “Grid” Bot with Coygo).

Today I’m happy to announce our new crypto trading bot strategy for swing trading that is available to all Coygo users called “Ping pong swing trader”!

What is Coygo Bots?

Coygo Bots is a platform for creating and running crypto trading bots that help automate your crypto day trading. These trading bots can trade on your behalf using a number of different highly-configurable pre-built strategies including triangular arbitrage, swing trading, grid trading & more.

Unlike most other crypto trading bot platforms, Coygo Bots are run on your machine and not in the cloud on Coygo’s servers. This allows Coygo to offer a unique type of security — your exchange account credentials (API keys) are only stored encrypted on your machine. Coygo’s servers never have access to your accounts. This also allows Coygo Bots to execute on second or even millisecond intervals, making it perfect for arbitrage or other real-time trading strategies.

You can also code your own crypto trading bot strategy with JavaScript code using Coygo Forge!

What is crypto swing trading?

You’ll see lots of different strategies described as swing trading but in general it involves trying to profit from market swings by making a number of trades over a short period of time, typically a day to a couple weeks. When it comes to crypto the rapid price fluctuations mean that you can perform swing trading on shorter intervals and often within a single day.

If you’d like to learn more about crypto swing trading see our blog post: Master Crypto Swing Trading With Automated Bots.

What is the “Ping pong swing trader” strategy?

This new strategy available within Coygo Bots alternates between buying and selling to “ping pong” back and forth as the price moves. It buys when the price drops by a configured percentage within a specific time period, then sells at a configured percentage above that buy price. This strategy will try to increase profits by following a market trending upwards or downwards before buying or selling, with stop-loss and take-profit triggers in place to lock in profits and avoid losses.

So how exactly does it work?

Determining entry price

  1. A reference price R is set to the current ask (buy) rate.
  2. The bot determines the entry price to buy
    — 2a. A buy order is opened at R minus some configured percentage “Price drop % buy trigger”.
    2b. A stop-loss sell price is set to the buy price minus a configured stop-loss percentage “Stop loss %”.

After submitting a buy order

  1. If, within one time frame of “Dynamic price interval”, the buy order has completely filled
    — 1a. A sell order is opened at the buy price plus the “Minimum profit %
  2. If, within one time frame of “Dynamic price interval”, the price has dropped below the buy order price minus the configured “Stop loss %” the open limit sell order will be canceled and a market sell order will be submitted to exit the position and prevent further losses.
  3. If, after one complete time frame of “Dynamic price interval” the buy order didn’t completely fill
    — 3a. The bot will reset a new reference price R to the last traded price.
    — 3b. The bot cancels the open buy order and re-open it at R minus the configured percentage “Price drop % buy trigger”. This allows the bot to follow a market trending downwards before buying.

After submitting a sell order

  1. If, within one time frame of “Dynamic price interval”, the sell order has completely filled
    — 1a. It’s time to determine the next buy order. Goes back to “1. The bot determines the entry price to buy” and repeat the cycle.
  2. If, after one complete time frame of “Dynamic price interval”, the sell order didn’t completely fill
    — 2a. If market’s bid price is still above our buy price, and it has moved up since the last “Dynamic price interval
    — — 2a1. The bot will reset a new reference price R to the last traded price.
    — — 2a2. The bot cancels the open sell order and re-opens it at R plus the configured “Minimum profit %”.
    — — 2a3. This allows the bot to follow a market trending upwards before selling.
    — 2b. If this market’s bid price is still above our buy price + “Minimum profit %”, but it has moved down or stayed equal since the last “Dynamic price interval
    — — 2b1. The Bot will assume this market is no longer trending upwards and it will take profits by canceling the order and immediately submitting a market sell order.

How to create a “Ping pong swing trader” crypto trading bot with Coygo Bots

1. Sign in to Coygo Terminal

The Coygo Bots platform is available within Coygo Terminal, a downloadable desktop application for macOS, Windows and Linux. First you will need to sign in to Coygo Terminal. If you don’t have an account, you can start a free trial today! Learn more on our pricing page.

Coygo Terminal

2. Go to “My Strategies” to select the “Ping pong swing trader” strategy

Within Coygo Bots you can use the “My Strategies” page to see a list of every trading bot strategy that you can use. Here you will find “Ping pong swing trader”. You can click the “+ Create Bot” button on this strategy to create a new trading bot!

Creating a new trading bot

3. Configure your trading bot

Now that you’ve created your trading bot you will need to configure it to your specific preferences. It’s up to you to decide which exchange and trade pair to use, as well as your buy trigger is, stop-loss, and other configurations. Each option has a descriptive label to explain how it will be used by the Bot. Please see the video at the top of this post if you want a walk-through of each configuration property.

(Don’t worry — you can run your trading bots in Test Mode to try different configurations without using real money or submitting real orders.)

The most important configuration options are the following:

Dynamic price interval

  • Determines when to dynamically reset buy/sell rates.
  • If the price drops (for buys) or rises (for sells) by our target percentage within this interval it will be bought or sold.
  • If the price does not hit our buy or sell target within this interval, the buy/sell rates will be reset relative to the ask or bid rate of this market.
  • This allows the Bot to follow trends up or down before buying/selling.
  • For example: If this is is set to 30 minutes, and the “Price drop % buy trigger” is set to 1%, and the price drops >=1% within 30 minutes it will be bought.

Price drop % buy trigger

  • When the price drops by this % within the “Dynamic price interval”, a buy order will be submitted.
  • For example: If your “Dynamic price interval” is set to 30 minutes and your “Price drop % buy trigger” is set to 1%: A buy order will be triggered if the price drops by >=1% within 30 minutes

Minimum profit %

  • The minimum desired profit % used for configuring sell prices. When a buy order is submitted an accompanying sell order will be opened at the buy order rate + “Minimum profit %”.

Stop-loss %

  • If the Bot has entered a position by buying an asset, and then the asset’s price drops by >= this percent within one “Dynamic price interval”, the Bot will sell the position to prevent further losses.
Configuring your “Ping pong swing trader” bot

4. Run your new trading bot!

Now that you’ve created and configured your trading bot it’s time to try running it on the “Run” screen for this Bot. You can choose how long you want it to run (or indefinitely if you so choose), and you can enable Test Mode if you want the bot to simulate trades. If using Test Mode you can specify any fake wallet balances you want the Bot to use.

Run your new trading bot

5. Monitor your running trading bot

While your trading bot is running it will keep you informed with real-time data about the bot’s decision making and orders submitted.

One particularly helpful tool is the Activity Log on the left in which you will see a descriptive explanation of what the bot is doing and any decisions it’s making during each interval of execution. The Activity Log will default to showing the latest data but you can always go back in time and view previous intervals to get an understanding of exactly what your trading bot is doing over time.

Running bot

6. Stop your trading bot

When you started to run your trading bot you chose a maximum run time, perhaps 4 or 8 hours. When this amount of time has completed the bot will stop itself. You can also click the “Stop This Bot” button at any time while the bot is running to immediately stop it as well.

Try Coygo for free today

If you’re interested in Coygo Bots you can start a free trial today. We would love to hear your feedback! We want to make sure we’re providing the best possible solution for you.

Follow us on social media and subscribe to our blog to keep up to date with Coygo’s progress as we continue to develop the best tools for cryptocurrency and digital asset traders.

Facebook: https://www.facebook.com/CoygoHQ/

LinkedIn: https://www.linkedin.com/company/coygo

Twitter: https://twitter.com/CoygoHQ

--

--

Evan Francis
Coygo Blog

CEO and Co-founder of Coygo, Inc. and Lunafi, LLC, cryptocurrency enthusiast, software engineer, alpine skier