OPEN-SOURCE SCRIPT

Double Supertrend

Zaktualizowano
This strategy is based on a custom indicator that was created based on the Supertrend indicator. At its core, there are always 2 super trend indicators with different factors to reduce market noise (false signals).

The strategy/indicator has some parameters to improve the signals and filters.

TECHNICAL ANALYSIS

☑ Show Indicators
This option will enable/disable the Supertrend indicators on the chart.

☑ Length
The length will be used on the Supertrend Indicator to calculate its values.

☑ Dev Fast
The fast deviation or factor from one of the super trend indicators. This will be the leading indicator for entry signals, as well as for the exit signals.

☑ Dev Slow
The slow deviation or factor from one of the super trend indicators. This will be the confirmation indicator for entry and exit signals.

☑ Exit Type
It's possible to select from 4 options for the exit signals. Exit signals always take profit target.
☑ ⥹ Reversals
This option will make the strategy/indicator calculate the exit signals based on the difference between the given period's highest and lowest candle value (see Period on this list). It's displayed on the chart with the cross. As it's possible to verify in the image below, there are multiple exit spots for every entry.
snapshot
☑ ⥹ ATR
Using ATR as a base indicator for exit signals will make the strategy/indicator place limit/stop orders. Candle High + ATR for longs, Candle Low - ATR for shorts. The strategy will show the ATR level for take profit and stick with it until the next signal. This way, the take profit value remains based on the candle of the entry signal.
snapshot
☑ ⥹ Fast Supertrend
With this option selected, the exit signals will be based on the Fast Supertsignal value, mirrored to make a profit.
snapshot
☑ ⥹ Slow Supertrend
With this option selected, the exit signals will be based on the Slow Supertsignal value, which is mirrored to take profit.
snapshot

☑ Period
This will represent the number of candles used on the exit signals when Reversals is selected as Exit Type. It's also used to calculate the gradient used on the Fills and Supertrend signals.

☑ Multiplier
It's used on the take profit when the ATR option is selected on the Exit Type.

STRATEGY

☑ Use The Strategy
This will enable/disable the strategy to show the trades calculations.

☑ Show Use Long/Short Entries
Option to make the strategy show/use Long or Short signals. Available only if Use The Strategy is enabled

☑ Show Use Exit Long/Short
Option to make the strategy show/use Exit Long or Short signals (valid when Reversals option is selected on the Exit Type). Available only if Use The Strategy is enabled

☑ Show Use Add Long/Short
Option to make the strategy show/use Add Long or Short signals. With this option enabled, the strategy will place multiple trades in the same direction, almost the same concept as a pyramiding parameter. It's based on the Fast Supersignal when the candle fails to cross and reverses. Available only if Use The Strategy is enabled

☑ Trades Date Start/End
The date range that the strategy will check the market data and make the trades

HOW TO USE
It's very straightforward. A long signal will appear as a green arrow with a text Long below it. A short signal will appear as a red arrow with a text Short above it. It's ideal to wait for the candle to finish to validate the signal.
The exit signals are optional but give a good idea of the configuration used when backtesting. Each market and timeframe will have its own configuration for the best results. On average, sticking to ATR as an exit signal will have less risk than the other options.

☑ Entry Signals
Follow the arrows with Long/Short texts on them. Wait for the signal candle to close to validate the entry.

☑ Exit Signals
Use them to close your position or to trail stop your orders and maximize profits. Select the exit type suitable for each timeframe and market

☑ Add Entries
It's possible to increase the position following the add margin/contracts based on the Add signals. Not mandatory, but may work as reentries or late entries using the same signal.

☑ What about Stop Loss?
The stop-loss levels were not included as a separated signal because it's already in the chart. There are some possible ideas for the stop loss:
☑⥹ Candle High/Low (2nd recommend option)
When it's a Long signal from the entry signal candle, the stop loss can be the Low value of the same candle. Very tight stop loss in some cases, depending on the candle range
☑⥹ Local Top/Bottom
Selecting the local top/bottom as stop loss will give the strategy more room for false breakouts or reversals, keeping the trade open and minimizing noises. Increases the risk
☑⥹ Fast Supertrend (1st recommend option)
The fast supertrend can be used as stop-loss as well. making it a moving level and working close to trail stop management
☑⥹ Fixed Percentage
It's possible to use a fixed risk percentage for the trades, making the risk easier to control and project. Since the market volatility is not fixed, this may affect the accuracy of the trades
☑⥹ Based on the ATR (3rd recommend option)
When the exit type option ATR is selected, it will display the take profit level for that entry. Just mirror that value and put it as stop-loss, or multiply that amount by 1.5 to have more room for market noise.

EXAMPLE CONFIGURATIONS
Here are some configuration ideas for some markets (all of them are from crypto, especially futures markets)
BTCUSDT 15min - Default configuration
BTCUSDT 1h - Length 10 | Dev Fast 3 | Dev Slow 4 | Exit Type ATR | Period 50 | Multiplier 1
BTCUSDT 4h - Length 10 | Dev Fast 2 | Dev Slow 4 | Exit Type ATR | Period 50 | Multiplier 1
ETHUSDT 15min - Length 20 | Dev Fast 1 | Dev Slow 3 | Exit Type Fast Supertrend | Period 50 | Multiplier 1
IOTAUSDT 15min - Length 10 | Dev Fast 1 | Dev Slow 2 | Exit Type Slow Supertrend | Period 50 | Multiplier 1
OMGUSDT 15min - Length 10 | Dev Fast 1 | Dev Slow 4 | Exit Type Slow Supertrend | Period 50 | Multiplier 1
VETUSDT 15min - Length 10 | Dev Fast 3 | Dev Slow 4 | Exit Type Slow Supertrend | Period 50 | Multiplier 1

HOW TO FIND OTHER CONFIGURATIONS
Here are some steps to find suitable configurations
  • select a market and time frame
  • enable the Use This Strategy option on the strategy
  • open the strategy tester panel and select the performance summary
  • open the strategy configuration and go to properties
  • change the balance to the same price of the symbol (example: BTCUSDT 60.000, use 60.000 as balance)
  • go back to the inputs tab and keep changing the parameters until you see the net profit be positive and bigger than the absolute value of the drawdown
  • in case you can't find a suitable configuration, try other timeframes


Since the tester reflects what happened in the past candles, it's not guaranteed to give the same results. However, this indicator/Strategy can be used with other indicators as a leading signal or confirmation signal.



Informacje o Wersji
Added Alerts on Entry, Exit, and add orders
Average True Range (ATR)CryptocurrencystrategysupertrendSupport and Resistance

Skrypt open-source

W prawdziwym duchu TradingView autor tego skryptu opublikował go jako open source, aby inwestorzy mogli go zrozumieć i zweryfikować. Pozdrowienia dla autora! Możesz go używać bezpłatnie, ale ponowne użycie tego kodu w publikacji podlega Zasadom Regulaminu. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Chcesz użyć tego skryptu na wykresie?


Również na:

Wyłączenie odpowiedzialności