INVITE-ONLY SCRIPT

Swing Algo V1.4

◆ Introduction

The latest version of the Swing Algo features a complementary system consisting of two internal swing trading logics: an enhanced Swing Algo V1.3 and a secondary control engine to stabilize the overall strategy behaviour in times of increased market chop. Both algorithms feature different averaging lines as well as oscillators, leading to a higher strategy diversification for swing trading as well as a reduced maximum drawdown in comparison to each stand-alone strategy.

While the Swing Algo V1.x series so far featured a single trend-following swing algorithm for each release, where one just switches between Long and Short trades based on one general logic, here two strategies, which act independently of each other, are applied. Due to this, we introduce a third position a trader can be in: the Hedge. The overall logic is as follows:

  • When both sub-logics are Long, the overall strategy is Long.
  • When both sub-logics are Short, the overall strategy is Short.
  • When one sub-logic is Long and the other is Short, the overall strategy is in a Hedge position. It doesn't matter which component is Short and which is Long.


As PineScript doesn't currently offer a real steady hedging-function for two competing swing trading sub-logics (in the sense of a continuously applied Hedge state after hedging conditions are met at least once for an entry), a workaround via position closes was created for this release. For each new internal sub-signal, the overall strategy changes its state (Long/Short/Hedge) visibly on the chart, and the trader can adjust their position accordingly.

For detailed differences to previous Swing Algo V1.x releases, see further below.

◆ Purpose of this Script

This indicator will give Long, Short and Hedge signals on the chart that can be used for e.g. swing trading. Each of the aforementioned sub-logics uses a combination of several (custom) functions and rules to find good entry points for trend trading. After many iterations and tests I came up with this particular setup, which is highly optimized for the ETH/USD trading pair on the daily (D) timeframe.

Attention was also paid to stability, as all parameters are set onto plateaus, so that smaller changes in the characteristic price action should not affect the efficiancy too much, done as an attempt to reduce overfitting as much as possible. Additionally this dual algorithm system is specifically designed to have a safety net: should for the unlikely scenario one swing trading algorithm not trigger at a certain mid-term reversal point, the probability is high that the other will trigger, resulting in an overall hedged position (so that no money is lost in the meantime) until the first algorithm can rejoin at the next mid-term trend change.

For other assets and/or timeframes it is in principle possible to change algorithmic parameters within the indicator settings to tune the swing algorithms, though it is strongly recommended to use the standard asset and timeframe mentioned above.

◆ Viability

For the here presented backtest data, we omitted the biggest portion of the cryptocurrency bullrun in 2017 (starting only at 1st July 2017) so that the results become more realistic for long-term swing traders (investing at least 2-4 years into trading) if such large runs do not happen again. As cryptocurrencies like Ethereum are still to this date capable of doing comparatively smaller runs of about 2-3x in a few weeks/months during accumulation phases (as witnessed e.g. in 2020 and more recently in 2023) and bigger runs during bullmarkets (as witnessed in 2021), the quality of the shown results is still realistic for long-term trend trading efforts over several years, Note that very conservative trading parameters as mentioned below in "Forwardtesting and Backtesting" are used here.

Generally do not expect results in a matter of days or weeks, and of course as with any trading strategy past performances are not indicative of future results.

◆ Forwardtesting and Backtesting

The individual components have been back- and partially forwardtested: The first sub-logic is an advancement of Swing Algo V1.3, with which we have extensive experience running back to October 2020 for its release, while the secondary control strategy, which was privately published for DeanTrader members as a stand-alone script on TradingView in June 2022 and was running in the background since then, is showing good & expected behaviour so far.

While this does not mean that fowardtesting was performed specifically for the combined Swing Algo V1.4 system we have now (which cannot be done realistically considering the timeframes used, i.e. months and especially years), we can at least look at some considerable experience with the individual components. Then again, as I have implemented an exact hedging-function so that both sub-algorithms run independently from each other, it is not likely to see any unexpected behaviour resulting purely from the combination into one script.

For strategy backtesting you can choose the backtest time interval to test the performance of this algorithm for different time windows and different trading pairs. Here various backtesting parameters (e.g. trading fees) can be customized. Default settings for the shown backtest are a starting balance of $1000, a slippage of 20 ticks (= $0.20) and a trading fee of 0.05 % (which is the worst taker fee on the Kraken Pro futures exchange) to have realistic settings. However as we do not conduct many trades with this strategy, fees should not impact our performance too much. As long-term swing traders, we at DeanTrader generally devote one initial portion of our portfolio to swing trading and from then on always use 100% of this portion for the next trade to get the compounding starting. This is in difference to other trading styles which use various, often very small, percentage values for their short- or mid-term trades. Please note that for the here presented backtest only 10% of compounded equity is used for each successive trade to show an estimation for a lower risk & lower reward approach. Keep this in mind when evaluating the backtest data. You can set appropriate values for each backtest parameter in the "Properties" setting menu of the strategy, including the order size percentage of equity value for your trades. Also note that due to the small number of trades the statistical significance is low. It is not possible to gather an abundance of long-term trend signals in the order of hundreds or thousands trades, as much more time would have to pass for this in the case of rather new assets like Ethereum.

Additionally to the TradingView Strategy Tester you can also plot your equity directly on the chart to get a sense for the performance. For this you can also scale the equity graph to e.g. match the starting point of your equity with some price point on the chart to get a direct comparison to 'Buy & Hold' strategies over time.

This indicator (and all other content I provide) is no financial advice. If you use this indicator you agree to my Terms and Conditions which can be found on my website linked on my TradingView profile or in my signature.

◆ Visual Representation on the Chart

Shown below is a screenshot of how the chart looks like when the strategy is applied. Here we can see two different averaging lines, where each line belongs to one of the two sub-logics respectively. Note that this is not a MA-crossover strategy, and the crossing of the lines is not accounted for in the code at all and therefore has no effect on the strategy's signal output. Also note that the price scale is set on logarithmic.

ảnh chụp nhanh

The space between the lines is filled with a faint background color as a rough visual indicator. Magenta-colored fills indicate zones where only Short or Hedge signals can appear, while green-colored fills indicate zones where only Long or Hedge signals can appear. Gray-colored fills mark zones where only Hedge signals can appear, which also means that Hedge signals can appear in any zone. So treat those background fills more as a visual aid to roughly know what can happen next, but pay most attention to the actual signals (with arrows) that appear on the chart.

◆ Differences to Other Versions

  • Consists now of two competing sub-algorithms instead of just one algorithm. The new system outputs Long, Short and Hedge signals instead of just Long and Short signals.
  • The first sub-logic is the spiritual successor of the original Swing Algo V1.3 release, with a modified oscillator part.
  • The second sub-logic serves as a control algorithm (while still having equal rights in terms of strategy impact), newly introduced to the Swing Algo series, but already forwardtested for roughly a year at time of release.
  • Lowers risk significantly by diversifying swing trading strategies, so that for the rare scenario of a missed trend on one sub-algorithm, losses are prevented as the overall strategy is hedged during that time.
  • Lowers risk further as the maximum drawdown of the combined strategy is reduced by roughly 1/3 in comparison to each stand-alone strategy while almost retaining the same net profit over a 6-year backtest compared to the first, leading sub-logic.
  • No guesswork anymore when to use which short leverage (1x corresponding to a Hedge, or 2x corresponding to a Short with an asset-value-change-to-gain-proportionality of -1) as it is clearly defined within the trading system via the displayed signals. In earlier Swing Algo versions, the short leverage for any particular Short signal had to be chosen by hand dependent on market sentiment, which required further market analysis, or was fixed at 2x, leading to less flexibility.


◆ Access

For access please contact me via DM on TradingView or via other channels (linked on my TradingView profile and in my signature).
algotradingEthereum (Cryptocurrency)longtermlongtermtradingswingswingtradingtradingTrend Analysis

Tập lệnh chỉ hiển thị cho người được mời

Quyền truy cập vào tập lệnh này bị hạn chế đối với người dùng được tác giả ủy quyền và thường yêu cầu thanh toán. Bạn có thể thêm nó vào mục yêu thích của mình, nhưng bạn sẽ chỉ có thể sử dụng nó sau khi yêu cầu sự cho phép từ tác giả. Liên hệ Dean_Trader để thêm thông tin, hoặc làm theo hướng dẫn của tác giả bên dưới.

TradingView gợi ý bạn không trả tiền để sử dụng tập lệnh trừ khi bạn tin tưởng 100% vào tác giả của tập lệnh và hiểu cách hoạt động của tập lệnh. Trong nhiều trường hợp, bạn có thể tìm thấy giải pháp thay thế nguồn mở tốt miễn phí trong Tập lệnh cộng đồng của chúng tôi.

Hướng dẫn của tác giả

All Ethereum trades based on this indicator are discussed in DeanTrader's private groups. To gain access to those you have to purchase the full DeanTrader Swing Algo V1 Series package. For this please contact me via DM on TradingView or visit my website.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Cảnh báo: vui lòng đọc trước khi yêu cầu quyền truy cập.

Website (for access to my scripts): deantrader.com
Twitter (for Swing Algo footage): twitter.com/Dean_Trader
Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm