SUPERTREND ATR WITH TRAILING STOP LOSS## THIS SCRIPT IS ON GITHUB
## MORE BACKTEST
SuperTrend is a moving stop and reversal line based on the volatility (ATR).
The strategy will ride up your stop loss when price moviment 1%.
The strategy will close your operation when the market price crossed the stop loss.
The strategy will close operation when the line based on the volatility will crossed
The strategy has the following parameters:
+ **ATR PERIOD** - To select number of bars back to execute calculation
+ **ATR MULTPLIER** - To add a multplier factor on volatility
+ **INITIAL STOP LOSS** - Where can isert the value to first stop.
+ **POSITION TYPE** - Where can to select trade position.
+ **BACKTEST PERIOD** - To select range.
## DISCLAIMER
1. I am not licensed financial advisors or broker dealers. I do not tell you when or what to buy or sell. I developed this software which enables you execute manual or automated trades multiple trades using TradingView. The software allows you to set the criteria you want for entering and exiting trades.
2. Do not trade with money you cannot afford to lose.
3. I do not guarantee consistent profits or that anyone can make money with no effort. And I am not selling the holy grail.
4. Every system can have winning and losing streaks.
5. Money management plays a large role in the results of your trading. For example: lot size, account size, broker leverage, and broker margin call rules all have an effect on results. Also, your Take Profit and Stop Loss settings for individual pair trades and for overall account equity have a major impact on results. If you are new to trading and do not understand these items, then I recommend you seek education materials to further your knowledge.
**YOU NEED TO FIND AND USE THE TRADING SYSTEM THAT WORKS BEST FOR YOU AND YOUR TRADING TOLERANCE.**
**I HAVE PROVIDED NOTHING MORE THAN A TOOL WITH OPTIONS FOR YOU TO TRADE WITH THIS PROGRAM ON TRADINGVIEW.**
## NOTE
I accept suggestions to improve the script.
If you encounter any problems i will be happy to share with me.
+ Authors: @exit490
+ Revision: v1.0.0
+ Date: 5-Aug-2019
+ Pinescript version: 4
## LICENSE
Copyright 2019 Mauricio Pimenta / exit490
SuperTrend with Trailing Stop Loss script may be freely distributed under the (../LICENSE).
Supertrend
QuantNomad - SuperTrend - XBTUSD - 1mInteresting performance for Super Trend strategy for XBTUSD 1m chart.
Params: ST Mult: 2, ST Period 14.
Performance: 144% profit, 1988 trades, only 41% prof, 2.04% dd , 2.51 Sharpe.
On its own, it might be not a very good strategy, but the big amount of trades allows you to add more filters and improve it.
And remember:
Past performance does not guarantee future results.
QuantNomad - SuperTrend - TSLA - 1mInteresting performance for Super Trend strategy for Tesla ( TSLA ) 1m chart.
Params: ST Mult: 3, ST Period 120.
Performance:61% profit, 637 trades, only 33% prof, 4.84% dd , 0.4 Sharpe.
On its own, it might be not a very good strategy, but the big amount of trades allows you to add more filters and improve it.
The strategy is not bad both with "when" params when strategy executed on open of next bar and with stop orders when strategy enters on exact Super Trend level.
You can comment/uncomment lines in the code and switch from one approach to another.
And remember:
Past performance does not guarantee future results.
Adaptive Autonomous Recursive Trailing StopIntroduction
Trailing stop are important indicators in technical analysis, today i propose a new trailing stop A2RTS based on my last published indicator A2RMA (1), this last indicator directly used an error measurement thus providing a way to create enveloppes, which provide a direct way to create trailing stops based on highest/lowest rules.
The Indicator
If you need a more detailed explanation of this indicator i encourage you to check the A2RMA indicator post i made, parameters does not differ from the supertrend, thus having a length parameter and a factor parameter who is here described as gamma , gamma control how far away are the bands from each others thus spotting longer terms trends when gamma is higher.
On BTCUSD
Something worth mentioning is that the indicator sometimes behave like my MTA trailing stop indicator (2) who is closer to the price when a trend persist thus providing early exit points, however A2RTS behave a bit better.
Price can sometimes break the trailing stop, this can be interpreted as a support/resistance or just as an exit point, the support resistance methodology on trailing stop is not the most recommended.
Sometimes it is recommended to have an higher length rather than an high gamma like in this case for INTEL CORP, below gamma = 3 and length = 20
The microprocessor market like to use higher length's instead of higher gamma's , A2RMA is a non-linear filter, this would explain such behaviour.
Conclusion
Trailing stops might not suffer as much from whipsaw trades than MA crossovers but they still remain inefficient when market is not trending, results of the proposed indicator on major forex pairs are more than disappointing, but i hope this will serve as basis for other trailing stops that might act a little bit better. I conclude this post by thanking everyone who support my work and i encourage you to modify this indicator and share it with the community.
Thanks for reading !
Cited Articles
Supertrend collectorHello traders
This is an example of how you can add multiple indicators into a unique one
In this instance, I added two supertrend multitimeframes and draw them on a different timeframe chart
Enjoy
David
X system v1Similar to X system but here I use the super trend with MTF function
the sell option depend on the % channel sell seen in red as bearish rule (so both need to agree)
the buy option depend only on the MTF which is set on 2 hour on 1 hour candles. you can try to modify if you want shorter times to see if it better
if you want it sell more just remove the and bearish rule from t green for buy in the code
try to make it better and I hope it can help you :)
X systemSo how this system work ?
1. the bullish and bearish zones in lime and red are based on percent channel (you can modify it according to your needs) . this now is on 1 hour candles so I set it to 1% above and 3% bellow for BTC on bitmex.
2. we ha RSI super trend system which generate our buy and sell signals .
Since the Super trend is an RSI like it act like one as we can see when it go from high to low much more easy compare to regular super trend
One can optimize it to be full auto mode but it need more work to be much better and safe
This indicator aim is to help you in your decisions for buy and sell and I would not advise to use it as a bot but as a helper when you decide to buy and sell
Supertrend V1.0 - Buy or Sell SignalA test of the Supertrend Indicator. If I have made any mischaracterizations and mistakes, please let me know in the comments.
MTA-Traling StopIntroduction
Based on my previous indicator , this indicator plot a trailing stop using classic conditions.
Using The Indicator
Like any trailing stop when price is higher than the trailing stop this imply a buy signals, when price is lower than the trailing stop this imply a sell signal. It is possible to use decimals instead of integers for length as shown here :
length = 14.7
The indicator tend to react faster to price movements when a trend has been really long, this methodology is similar to the one used by the parabolic sar.
Downsides
Lack of robustness with the length parameter, the behaviour of the trailing stop can be hard to predict. There is a real need for control.
Conclusion
The indicator can be adaptive, even if it already is in a certain way, by changing the alpha variable at the start considering that 0 < alpha < 1. Its not recommended to use it right now except for testing/coding purpose.
It is clear that i'm not enthusiast when it come to this script, there is a real lack of accuracy, i still hope it can be of use.
SuperTrendThis is a redesign of the SuperTrend indicator. It removes stupid transitions between SuperTrend states and highlights initial points for both lines.
SuperTrend is a moving stop and reversal line based on the volatility (ATR).
Supertrend Multi Time Frame - Auto HTF calculationThere is already SuperTrend indicator and thanks to its developer.
This script draws supertrend for current and higher time frame, it automatically calculates higher time frame and you don't need to adjust it when you change the period.
it also change the color of bars according to current and HTF supertrend, so you can see the trend by looking at bars color.
Bar color is lime if trend is up and red if trend is down. but if you see white bars then there is movement opposite the main trend.
if you like it please comment.
Supertrend with EMAThere are many supertrend scripts, most uses close as source. This one uses EMA. You can change periods and factor settings by your trading strategy.
Efficient Auto LineMore Efficiency
Based on the Auto-Line code, the Efficient Auto Line aim to provide a more controlled adaptivity of the indicator. The first indicator of this sort worked this way : when the absolute difference between the price and the indicator is higher than the previous indicator +/- A pips of amplitude, the indicator will display the closing price, else its anterior value. The second indicator (Auto-Line) was adaptive and used the standard deviation instead of a constant A . This indicator will run both methodology providing both a trend strength indicator (Efficiency Ratio) parameter and two constant parameter.
Parameters
The length parameter will control the period of the efficiency ratio, a high period return lower values of the efficiency ratio. Since its an indicator in a range of (0,1) we use it to make our indicator more adaptive in trending market, this is when we need our two constant parameters, the fast/slow parameter can be any amount of pips where fast < slow , when the price is trending (efficiency ratio close to 1) the indicator will use the fast parameter, if its ranging (efficiency ratio away from 1) the indicator will use the slow parameter, then it will work like the first methodology previously explained. So the fast parameter should be equal to a small movement of pips (0.0001 or 1 pip) and the slow parameter should be equal to a number of pips you wont expect to see in a ranging market. At this point it is good to test for both parameter and see which values work better (a more automatic process is in development) .
Hope you like it !
RSI ST MTFUsing this script with some changes
I try to build the RSI SUPERTREND model with MTF function
I think its need more work to refine it but as idea its nice
RSI -SUPERTRENDThis is hybrid of Super trend and RSI
the green and red zones are by the supertrend
so it seems the two indicator can compleemnt each other
SuperTrend MultiTimeFrame (v.3 PineScipt)New version of SuperTrend MultiTimeframe with alert.
It is like old version but use V3 of PineScript (no repainting if you want to change it and transform in strategy).
Enjoy!
makemoney-hybridSo this model is little different from moneymaker model in the following :
The buy system based on super trend , the sell system =S is based on the volume model of money maker
in the example we set 7% take profit for both long or short . you can set it even higher since btc very volatile now
in cases where it did not reach the target its made min of 3% each direction
So the buy in this system will be in true uptrend . since now the btc is falling more then going up we can make more money on shorts and wait for the longs when they come :)
the bullish and bear zone based on super system
you need to set correctly your take profit in order to make it to work . the more volatile will be the coin the better will be the results (this is the theory )
Supertrend FilterA derivation of the famous SuperTrend indicator.
My motivation for such indicator was to use more recursion in the original SuperTrend code, this work was made quite fast but feel free to modify it, as always my work is more for inspirational use than anything else so i hope it will inspire you to get more involved with the SuperTrend code or to start coding with Pine.
The indicator no longer act as a trailing-stop but more like a filter, this is due to the fact that the indicator conditions are swapped and that the output is reused many times in the calculation.
Parameters change as well and involve particular gestion. The Factor Parameter is no longer an integer but decimals such that 0 < Factor < 1 .
When the Period is high the indicator tend to become less linear/static and look more like a classic moving average.So it is important to have higher Factor values when the Period is high and reciprocally.Here a table to help you with parameters settings :
for Period = 1 to 50 Factor = 0.5
for Period = 50 to 100 Factor = 0.6
for Period = 100 to 150 Factor = 0.7
for Period = 150 to 200 Factor = 0.8
for Period = 200 to 300 Factor = 0.9
There could be a formula to scale the Factor depending on the Period but there would be no proof that the scaling method used is optimal.
Hope you enjoy
For any questions/demands feel free to pm me, i would be happy to help you
Supertrend//Author - Rajandran R
//www.marketcalls.in
study("Supertrend V1.0 - Buy or Sell Signal", overlay = true)
Factor=input(2, minval=1,maxval = 100)
Pd=input(7, minval=1,maxval = 100)
Up=hl2-(Factor*atr(Pd))
Dn=hl2+(Factor*atr(Pd))
TrendUp=close >TrendUp ? max(Up,TrendUp ) : Up
TrendDown=close TrendDown ? 1: close< TrendUp ? -1: nz(Trend ,1)
Tsl = Trend==1? TrendUp: TrendDown
linecolor = Trend == 1 ? green : red
plot(Tsl, color = linecolor , style = line , linewidth = 2,title = "SuperTrend")
plotshape(cross(close,Tsl) and close>Tsl , "Up Arrow", shape.triangleup,location.belowbar,green,0,0)
plotshape(cross(Tsl,close) and close<Tsl , "Down Arrow", shape.triangledown , location.abovebar, red,0,0)
//plot(Trend==1 and Trend ==-1,color = linecolor, style = circles, linewidth = 3,title="Trend")
plotarrow(Trend == 1 and Trend == -1 ? Trend : na, title="Up Entry Arrow", colorup=lime, maxheight=60, minheight=50, transp=0)
plotarrow(Trend == -1 and Trend == 1 ? Trend : na, title="Down Entry Arrow", colordown=red, maxheight=60, minheight=50, transp=0)
Super-Trend-fibIn this model we have fib Donchian channel with super trend alerts (B=buy) S =sell
and trailing volume system up trend alert and down trend alert
so have fun