Dynamic Trailing Stop Loss and Profit Target with Machine Learning
Last Updated on May 28, 2020 by admin
Crypto-ML has been steadily releasing risk management features for its cryptocurrency trading signals. These features are controls designed to (a) help avoid excessive losses and (b) help protect profitable positions. Trading systems that are effective in the long run emphasize risk management principles.
This post will cover two of Crypto-ML’s risk management features:
- Dynamic trailing stop losses
- Dynamic profit targets
Dynamic Trailing Stop Losses
Trailing stops are used to avoid loss and protect profit. Trailing stop losses are initially set at a percentage below the trade’s open price. Then, if price moves up, the trailing stop will also move up. However, if price moves back down, the trailing stop loss stays put; it does not move back in the other direction.
Release 3.0 of the Crypto-ML trading platform introduced intelligent stop losses and trailing stops. The values for these are determined at the time the trade is opened and are set by our machine learning optimization algorithms.
With Release 5.2, the trailing stop losses are now dynamic. As a trade moves up, the trailing stop loss can tighten in order to better protect profit.
The point at which the trailing stop loss tightens and by how much is determined by the machine learning optimization algorithms.
|Time||Bitcoin Price||Trailing Stop||Trailing Stop Price||Comment|
|6||$9,600||-2.00%||$9,408||Trailing stop adjusts.|
|8||$9,400||-2.00%||$9,457||Stop for 5% gain|
Dynamic Profit Targets
In addition to the dynamic trailing stops, Crypto-ML Release 5.2 adds dynamic profit targets. Profit targets close out trades when the trade’s goal is achieved.
When professional traders plan a trade, they typically determine:
- Entry point
- Exit if wrong (stop loss)
- Exit if right (profit target)
By mapping out the entire trade, you can better identify the risk and reward.
In addition, this helps avoid staying in a trade too long. Staying in a profitable trade adds unnecessary risk that can result in unrealized gains turning into realized losses.
In terms of Crypto-ML’s mechanism, a trade is opened when the neural network generates a price prediction that exceeds a predetermined “buy” threshold. The output of our neural networks is the prediction of where price will be 24 hours from now.
This prediction also determines the trade’s goal.
As an example, our optimizers may have determined any predicted gain of 2.4% or more should result in an open. If the neural network generates a 2.51% price gain prediction, then the trade opens (since it exceeded 2.4%). It also establishes the goals for the trade. Price is predicted to go up by 2.51% in the next 24 hours, so 2.51% is our profit target.
If the trade achieves a 2.51% gain, then the trade will close.
However, the profit target is also dynamic. To account for bull runs, the profit target can change as the trade evolves. While the trade is open, the neural networks continue to churn out price predictions. If these predictions move higher, then the profit target will also move higher.
In our example, the trade was opened based on a 2.51% prediction. Within the next few hours, the prediction could increase to 4.87%. If this happens, the profit target will be upgraded to 4.87%. This allows the trade to run.
Full Set of Trade Closure Features
The dynamic trailing stop and dynamic profit target features are two ways in which a trade can close.
Additionally, trades may be closed based on the neural network predictions. Just as the optimizer sets thresholds to open trades, it also sets thresholds to close trades.
As an example, a trade may be open on a 2.51% prediction. However, over the next few hours, the predictions may begin to drop. The neural network then issues a -1.87% prediction. The optimizers have determined any prediction below -1.6 should result in a close. Since -18.7 is less than -1.6, the trade closes.
Last, based on these 5.20 changes, trailing stops eliminate the need for hard stop losses. Previously, Crypto-ML had both stop losses and trailing stop losses. The stop losses were set at a hard value below the trade. The trailing stop loss was looser and would begin moving up once the position became profitable. However, thanks to the dynamic capabilities, the trailing stop acts effectively as both the initial stop and the ongoing stop mechanism.
Altogether, trades can be closed in one of three ways:
- Price falls below the trailing stop loss value
- Price rises above the profit target value
- The neural network predicts a sufficiently large price drop
Real-Time Market Monitoring
Crypto-ML’s neural network runs happen in steady intervals. Given the swing trade nature of the platform and the depth of processing, it does not make sense to run in real-time.
However, there are many times the market moves quickly and we want to react outside of these standard intervals.
In order to best handle risk-management features, Crypto-ML has a second set of jobs running to monitor the markets in real-time.
If an exceptional price movement occurs, a trailing stop is hit, or a profit target is hit, then this monitoring feature will trigger a full neural network run. This will gather all of the data needed to make an effective decision and close the trade on the spot.
Machine Learning’s Role
Crypto-ML’s design principle is to use machine learning to:
- Determine if a particular tool (such as a profit target) is useful.
- If the tool is useful, determine the parameters for it.
As such, there isn’t a single parameter within our solution that is determined by humans.
- Where should the trailing stop initially be set? Optimizer
- When should the trailing stop be tightened? Optimizer
- When tightened, by how much? Optimizer
- As market conditions change, when should these values change? Optimizer
For profit targets, machine learning answers these questions:
- Where should the initial target be set? Neural Network
- When should we increase the target? Neural Network
- What should the revised target be set to? Neural Network
If you’re interested in learning more about our system:
We have yet to do a deep dive into the optimizer algorithms, but if you want to research on your own, we currently use a blackbox optimization method, NOMAD (Nonlinear Optimization by Mesh Adaptive Direct Search), with Python. However, many optimization options are available and we regularly utilize different solutions. For additional reading:
- Optimization with Python (Learn Programming)
- Scientific Python: Using SciPy for Optimization (Real Python)
- Optimization with Python: How to make the most amount of money with the least amount of risk? (Towards Data Science)
What Crypto-ML Customers Can Expect
No action is required from our customers to start using these features. They are now baked into the overall system.
However, you may see some noticeable changes in behavior. In general, these features will bring faster trades that close more quickly than they have in the past. You will be less likely to see trades open for days. Ideally, we’ll also see consistent gains that effectively build our collective portfolios.
If you’re not yet a customer, you may sign up for one of our free or paid accounts and get started today.
Crypto-ML provides machine learning for crypto traders and investors. Gain crystal-clear signals and deep market insights. Add predictive capabilities to your toolbox. Learn more and join for free.