TradingView
UnknownUnicorn2151907
Jul 26, 2019 1:35 PM

RePaNoCHa V4 [Alerts] 

Bitcoin / US Dollar Perpetual Inverse Swap ContractBitMEX

Description

Script for automatic trading with Alerts.

LG --> Long (green: not confirmed) (lime: confirmed)
ST --> Short (maroon: not confirmed) (red: confirmed)
TS --> Trailing Stop
xL --> Close Long Position
xS --> Close Short Position
SL --> Stop Loss

The trailing stop closes the trade if the price changes direction by a specified percentage or offset. There is no ideal distance because markets and price are always changing and we know that is impossible to exit on the top or bottom. This script interpolate the trailing Stop Offset with profit, higher profit --> higher Trailing Stop Offset. Despite this, it's difficult to catch the price but not impossible. It has a TS delay too. It take a snapshot every X seconds, if the TS is activated the alert is triggered, otherwise the price keeps fluctuating until a new snapshot.

It can be easily converted to Backtest. Just delete "//" on the corresponding part.

Default settings for XBT:USD at 1H.

Release Notes

Added RSI and MACD

Release Notes

Repeated part deleted

Release Notes

Stop Loss bug fixed
Added option for activate not confirmed signals (better profit but high risk)

Release Notes

Xlong & Xshort fixed

Release Notes

Now the Trailing Stop can be triggered even if price is lower than the activation limit just like the strategy or backtest script.

Release Notes

Confirmed signals improved and added independent alerts for TS.

Release Notes

Limit orders for better profit & one alert every minute closing X% only for TS.

Release Notes

Enjoy!

Release Notes

SL

Release Notes

New rebuild optimized for closing the position every minute with X% in every Trailing Stop alert only. Stop Loss Fixed. Now this is the Super-RePaNoCHa script ;-)

An example on a 5 minutes timeframe for XBTUSD (BITMEX)

Position Side = BOTH
Source = hlc3
T3 Length = 20
T3 Volume Factor = 0.3
Sampling Period = 30
Range Multiplier = 3.2
ADX lenght = 48
ADX Threshold = 15
SAR start = 0.31
SAR inc = 0.2
SAR max = 0.12
RSI length = 34
RSI Center Line = 50
MACD Fast Length = 7
MACD Fast Length = 19
MACD Signal Length = 13
Trailing Stop Activation % = 0.5
Trailing Stop Offset % (when profit=0.5 %) = 0.25
Trailing Stop Offset % (when profit=10 %) = 1
Stop Loss = false
Tics/Pips Correction = 2
Initial Capital = 1000
Quantity = 100 %
Commission value = 0.075 %

Release Notes

A little improvement with Xlong/Xshort

Release Notes

New improvement with XConditions

Release Notes

Reconfigured to be shorter and better. Unconfirmed signals are more stable. Default settings for BINANCE BTC:USDT (Comission_value = 0.04 taker). TS Delay deleted. Set one alert per minute only for Trailing Stop, closing 10-25%.

Release Notes

...
Comments
mihaalgo
Hey @XaviZ, I noticed that:

//strategy.exit("Tsl", "long", trail_points = (abs((last_open_longCondition*(1+(tsi/100)))-last_open_longCondition)*pips_corection),
// trail_offset = (high*(ts/100))*pips_corection, loss = Act_sl ? (abs((last_open_longCondition*(1-(sl/100)))-last_open_longCondition)*pips_corection) : na)
//strategy.exit("Tss", "short", trail_points = (abs((last_open_shortCondition*(1-(tsi/100)))-last_open_shortCondition)*pips_corection),
// trail_offset = (low*(ts/100))*pips_corection, loss = Act_sl ? (abs((last_open_shortCondition*(1+(sl/100)))-last_open_shortCondition)*pips_corection) : na)

It does trigger an alarm on the strategy, but not on the study.

Example, when it is good:


Example when the alerts get triggered on the chart:


Is that due to the lack of PIP settings in the study?

Also, the sells and buys don't match, even if you put the same settings, as seen from the above snapshot.
Life_Analysis
Is it okay to use Heiken-ashi candles?
HNTrader
Hi, Thanks for sharing..this looks great.. just one question. I noticed that sometimes alert signals and strategy signals are not the same. Is there a reason for that?
UnknownUnicorn2151907
@HNTrader, You're welcome. It's because the Trailing Stop by default on strategies commands in TradingView cannot calculate the Dynamic Trailing Stop on the alerts version, but it's pretty similar.
FVM
Congrats!! However I have the same doubt. I've already deleted, but the pop-up is stil being showed. Could you help me?
UnknownUnicorn2151907
@FabioMartinsac, You have to delete de TS Delay part but don't worry, that's only a pop-up. ;-)
luciferlx
should put alert once per bar or only use once per bar closed?
UnknownUnicorn2151907
@luciferlx, always 'once per bar'
jclagrutta
Im pretty new to autoview and tradingview scripting. Could i get the alert setting for this strategy?
UnknownUnicorn2151907
@jclagrutta, You can find an example on the code above
More