The Magic of On-Chain Trailing Stop Loss

And how you can now pulldown risk in 1-click, giving you an automatic ejection when the markets tumble

Mitchell Opatowsky
Dexible
7 min readAug 11, 2022

--

In this article we cover:

  • What is the significance of volatility in crypto?
  • What’s a stop loss?
  • What’s is the difference between stop loss and trailing stop losses?
  • How to set up your own trailing stop loss in DeFi?

Imagine you’re in the middle of the Atlantic Ocean steering a small sailboat that you’re now regretting. With peak heights of 2 to 4 meters (that’s 6–12 ft for burgers), each passing wave could wipe you out. If you’re a hardened sailor, you might be able to ride over each looming crest not to capsize. Otherwise, on your own, you might be struggling for survival and every passing minute might be your last.

Didn’t think you were going to be learning about waves, but here we are…

Does surviving choppy seas, sound familiar? DeFi has been no stranger to excessive volatility, and most would say it feels a little different than sea sickness from brutal deep sea waves. And given the emphasis on self-responsibility our space upholds, it falls on your shoulders to set a course that can navigate the crests and down the troughs.

Of course, traders are no strangers to this phenomenon. Emerging markets are deluged by volatility. Take for instance this article from 2000 citing rampant volatility in internet stocks. Or this NYT article titled “THE MARKETS; Nasdaq Market at 5,000: Volatility as Way of Life” with this little tidbit:

While most stocks were falling, the enthusiasm for the ‘’new economy,’’ dominated by the Internet, has only increased among investors in recent months. And the performance of those stocks has not matched that of biotechnology

While it’s natural for emerging markets to experience rollercoaster price swings, shifting narratives, and oversaturated competitive landscapes, DeFi is different. DeFi feels unnatural for financially savvy users while totally foreign to newcomers. All of the protections that normal speculators expect, really don’t exist yet. Therefore, the responsibility falls on the trader’s shoulders to fend for themselves at the end of the day.

Fortunately, there now exist techniques that allow traders to gain exposure to assets in DeFi and become self-sovereign while not compromising these principles for financial discipline.

To address the friction that comes with self-sovereignty, many traders are willing to compromise a bit of control for ease of use. Thus many app interfaces reflect a quality of libertarian paternalism, where UX is meant to guide users toward their preferred outcomes.

The key guide to outcomes and control is in the form of conditionality.

Inherent demand for DeFi comes from competitive asset utilization and economic participation use cases that have driven a lot of speculation, resulting in trading tools and mechanisms to move money. But these mechanisms have largely overlooked conditionality.

Conditional (adj.) — Refers to the quality of trade orders having dependencies to one or more specified criteria.

Nearly half of the trades placed on centralized exchanges like Kraken are conditional orders and about 40% of all trades are limit orders. This is because conditional orders help minimize risk and maximize value capture. One proven way to navigate volatility is to employ Trailing Stops.

Why do Trailing Stops Exist?

Think of Trailing Stops like this puppy.

What if, just like dragging this puppy along the floor, you could just drag your prices up? Here’s an example, and we’ll dive into how this works after:

  • A trader has 10 open liquid positions they manage in their spare time. One of them is a highly volatile asset.
  • A trader indicates they want to draw down risk from this highly volatile asset (let’s say it swings up and down 20% per week).
  • They choose a 15% peak price deviation, the stop trigger.
  • The order is submitted.
  • Later that day, prices shot up by 10%, and fall down 6%.
  • Then ahead of a new partnership the next day, prices shoot up 14%; later that night, another part of the world wakes up and prices plummet as the news breaks overnight.
  • Trader ends up with an order firing off 5% above when they initiated the order, as opposed to losing money had they not withdrawn.

Some Terms:

  • Spot Price Rate: the rate of output tokens, in this case, a stablecoin, per input tokens, the volatile asset (AKA the RO/IT)
  • Peak Price: based on how high the price rate has gone, it sets a new peak. The previous peak of +10% got replaced with a new high of +20% above the Spot Price Rate.
  • Stop Trigger: this is the 15% percent below the highest price when the order should fire off.
  • Stop Loss: An order type that’s functionally a market sell.

Additional Terms:

  • Slippage: price impact the trader succumbs from their swap due to a price recalculation affected by the available liquidity.
  • Order Splitting: A slippage-minimizing technique Dexible uniquely employs to maximize output if it means the user makes more in the end.

Trailing Stop Losses are important because:

  1. Trailing Stops serve to protect traders.
  2. It’s an easy way to minimize your risk while maximizing your gains.
  3. Conditionality removes emotion from the equation.

Trailing Stop Loss Mechanics

First, a “stop” can be thought of as a “trigger”. It’s an asset price meant to mark the start of some action. Sometimes it’s to sell and sometimes it’s to buy. For example, a “Stop Loss” strategy is meant to protect against further losses and sell assets when the market drops below your stop price. The Trailing Stop strategy is similar, except the trader wants the stop price to move up with the market.

The intent is to maximize profit and protect against sharp drops after a steady climb in price. As the price increases, the stop increases along with it. The idea is to stay below market at a certain percentage and if there is a sudden drop below that percentage, the asset is sold at market to capture profit.

  1. A sell order is automatically triggered when a token price falls below a specified price rate between two assets.
  2. A trailing stop moves up as the price rate between the two assets moves higher, potentially in the trader’s favor.

If the trader hadn’t submitted a Trailing Stop Loss, here’s what they’d be looking at:

  • A trader is trying to drawdown risk in a TOKEN by swapping back into a STABLECOIN. Today, they’d get a price alert from a crypto app on their phone (there are dozens of apps that do this now).
  • They rush to their computer (or their mobile app if they have one) to make a decision.
  • Emotions might take over based on sentiment, and they stay in the market. (potentially due to loss aversion, sunk cost fallacy, a disposition effect, psychological inertia, the endowment effect, or a status quo bias) only for prices to sink further.
  • Let’s say they pull the trigger on the trade.
  • They then succumb to excessive slippage cost and transaction

Setting trailing stops is a fix for this multi-step headache.

How to Set Up Your Own

Here’s how:

  1. A trader can buy an asset at about $78 and sets a 10% trailing stop.
  2. The stop price will adjust as the market moves up as indicated by the orange line.
  3. In this case, the market went up to roughly $92 before dropping back down to about $79.
  4. At $92, the trailing stop would adjust to around $81. This is why you see the first stop trigger around the $81 mark — because the spot price dropped 10% off its $92 high. The trader profited about $3 per token or roughly 4%.
  5. Later, the trader buys back in at around $79. This time the market jumps up to nearly $99. At that level, the trailing stop would have adjusted to about $90. The second trigger fires when the market goes down to $90. The profit was about $11 per token or 14%.

Trailing Stops allow you to ride the waves with a safety net to catch you if the market drops too quickly. In DeFi, this strategy can only be employed by writing code or using Dexible’s automated DeFi trading platform.

try it now on Dexible

About Dexible

Dexible is the execution platform for DeFi. It combines dex aggregation and algos for DeFi execution. It routes across 60+ liquidity sources on all major chains and offers 7 algo order types.

Traders can use the web app or the low-code Typescript SDK. Also see the user documentation.

3rd parties can integrate Dexible Trade Portal and Dexible Widget for free to make a powerful DeFi algo suite available to their users in minutes, that’s earning them money along the way.

--

--