TheTradingParrot

TTP Alt Hedge

TheTradingParrot Zaktualizowano   
Alt hedge is a pine script that allows you to backtest and live hedge trade alt coin pairs.

Once you have selected 20 alt coins and your preferred take profit and a stop loss settings the script will find pairs: one coin that is very overbought and one that is very oversold. It will then long the one in discount and short the premium one.

The script will show you the PNL of the hedge combined position. If together they reach the TP or SL the position will be closed.

Use the "max profit retracement" to target larger TP levels and lock in profits if they retrace more than the chosen ratio. Example: if the TP retraces more than the golden ratio of 0.618 then close the position.

The indicator offers a table of profits with overall PNL and win rate stats.

It can be hooked up to WickHunter bots using alerts and the UUID of the bot.

Debug alerts shows the messages that will be sent for entry/exit deal messages.

Plot PNL shows the cumulative PNL in percentage in the same chart. This function is particularly useful since it shows the performance of the bot.

Each deal in this bot can consist of any pair of coins provided by the user. For example: long ADA + short ETH when ADA is very expensive and ETH is very cheap.

Consider using alt coins that have either strong or vey low correlation, the closer to 1 or -1 in correlation coefficient the better.

Have fun!
Informacje o Wersji:
- Added shapes to show entries and exits
- Improved algorithm to look down profits better
- Added new stats to table including max win/loss and win ratio percentage
- Retracement exit shown in the chart as white histogram
- PNL plot now using diamond chart
- now all entries and exit alerts are at candle close, backtests reflect actual opening and closing price for better consistency between live and backtest performances.
Informacje o Wersji:
Alert changes:
- Removes the ".P" prefix from perpetual symbol in accordance to WickHunter alert specs for alerts.
- Now we send a single alert with both the long and the short in the same message. This should reduce the risk of the bot only receiving one of them.

Stats changes:
- Added daily PNL % and days traded

NOTE: 3Commas is not supported yet since it would require sending alerts to two separated bots to be able to run the long and the short simultaneously which is doable but I fear it might make the setup a bit confusing for some users.
Informacje o Wersji:
Version 0.4 is available! 🦜

- We doubled down: hedge up to 40 altcoins (we supported only 20 before)
- New deal start condition: "volatility" - trade coins that are having a volatility breakout. This one is really helpful filtering out bad deals!
- New intra candle exit alerts toggle: if you are worried that the stop loss is executed at candle close we added the option to execute it intra candle to increase security. Be aware that enabling this option can cause the backtest to lose sync with the live bot. This can happen when the unrealised profit goes below SL and back above during the candle life.
- Performance improved to be able to support 40 symbols at the same time. Although you wouldn't notice since now we have to process twice as much data!
- Added max drawdown and run up stats to the table
- Improved Table layout to be able to see better the results at the blink of an eye 😉
- Better organised settings menu
Informacje o Wersji:
Added some new super cool features for all the pair trader enthusiasts out there! 🦜

- New pair performance ranking table: check the performance of each individual pair, is there a hidden outlier? then use the toggle and see how performance changes if disabling it - pain free ! Remember to enable it from settings, it's disabled by default.
- Correlation filter: now you can use the chart symbol to measure correlation. When enabled it will filter out pairs that are not deviated enough from the chart symbol. Try it with TOTAL2 or BTCUSDT In many cases I saw a 0.2 to 0.3% daily increase in PNL 😏
Informacje o Wersji:
Fixes winner/loser table PNL calculation issues.
Informacje o Wersji:
Support for 3Commas alerts is here!

Instructions:
1) Select pairs that correspond to the futures exchange that you are planning to use (spot or non-USDT contracts are not supported, only USDT perp)
2) From settings select the corresponding exchange. Binance and OKX on 3Commas are currently supported. We can add more exchanges if they are also supported on 3Commas for futures DCA composite bots.
3) Provide your 3Commas bot email token
4) Provide the Bot id for your long and short composite bots. See bot instructions below.
5) Select 3Commas as "alert provider"
6) Enable "Debug alerts" and compare the alerts for entries and exits with your bots and confirm that pair format and everything else looks correct. Once confirmed, disable it to prevent from causing performance issues.


Bot instructions:
1) Each 3commas bot must contain ALL pairs needed.
2) Both bots must use the same leverage
3) Both bots must have same amount of invested funds,
4) Hedge is not compatible with stop loss in the bot. If only ONE of the bots closes with the stop loss and the other one is still running then you are no longer "protected" by the pair. Of course, do your own research!
5) Do not use compound. On 3commas we are using two separated bots, so compounding would result in the bots trading with different amounts. If you want to use compounding, then use WickHunter since the same bot runs both long/short.
6) Set your bot TPs higher than the script TP to allow the strategy to take care of TP, again if you use a tight TP in the bot and it happened to trigger then the other bot might still be in a position which completely breaks the pair trading idea.

I have not tested live with this code, please report any issues via discord to our team to look into it.
Test only with a small amount until we get confident with the 3Commas integration.
Informacje o Wersji:
This version seems to fix the repainting issues.

I've been testing it in the 1min chart and so far I haven't been able to reproduce anymore any of the known issues.

In fact I'm going to migrate my own bot which has been using v0.6 to this version which is v0.8.

Crossing fingers it's all good now!
Informacje o Wersji:
v0.8.1

Added a timeout parameter.

If the deal is open after X candles it will automatically close. Disable by setting it to 0
The chart will show a label "TO" with blue background next to deals that closed by timeout.
Informacje o Wersji:
Bug fixes and new features:

- All versions before 0.9 were calculating profits from the % move of the spread (close A / close B). In this new version profits are calculated from total floating PNL of A + B / 2 This gives the real PNL compared to the spread method. You will noticed reduce and more realistic results.

- Plots with the profit of each pair floating PNL. Now you can visualise how each of the coins performance is progressing individually. Each plot will show in gray unless its in profit. Once the line turns green it will mean the long is in profit. IF it turns in red will mean the short enters the profit area.

- Data window additional data. In the data window you will find the following new items: longEntryClose (the entry close price of the long), closeLong (current close of the long), longFloatingP (percentage floating PNL of long), and the same values for the corresponding short.

Join our membership to gain access to the private scripts.
www.thetradingparrot.com
Skrypt tylko na zaproszenie

Dostęp do tego skryptu mają tylko użytkownicy upoważnieni przez autora i zazwyczaj wiąże się z opłatą. Możesz dodać go do ulubionych, ale będziesz mógł z niego korzystać dopiero po uzyskaniu zgody jego autora. Aby uzyskać więcej informacji, skontaktuj się z TheTradingParrot, lub postępuj zgodnie z poniższymi instrukcjami autora.

TradingView sugeruje, abyś nie płacił za skrypt i nie używał go, jeśli nie ufasz autorowi w 100 % i nie rozumiesz, jak działa skrypt. W wielu przypadkach można znaleźć dobrą alternatywę open-source za darmo wśród naszych Skryptów Społeczności.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Instrukcje autora

thetradingparrot.com Get the observer tier trial if you interested in giving it a go.

Chcesz użyć tego skryptu na wykresie?

Uwaga: przeczytaj to, zanim poprosisz o dostęp.