Scalping using RSI 2 indicator with TP and TSLThis study implements a simply scalping using the RSI (calculated on two periods), the slopes of two MAs (EMA or SMA) having different lengths (by default, I use 50 and 200).
A take profit (%) and a trailing stop loss (%) are used.
Entry conditions:
.) Fast MA > Slow MA and Price > Slow MA and RSI < Oversold Threshold ------> go Long
.) Fast MA < Slow MA and Price < Slow MA and RSI > Overbought Threshold ------> go Short
Exit conditions:
.) Long entry condition is true and (close >= TP or close <= TSL) ----> close short position
.) Short entry condition is true and (close <= TP or close >= TSL) ----> close long position
The strategy performed best on Bitcoin and the most liquid and capitalized Altcoins but works excellent on volatile assets, mainly if they often go trending.
Works best on 3h - 4h time frame.
There's also an optional Volatility filter, which opens the position only if the difference between the two slopes is more than a specific value, which can be set in the study inputs. The purpose is not opening positions if the price goes sideways and the noise is way > than the signal.
Note:
.) the RSI length is 2;
.) the oversold Threshold is 90%;
.) the overbought Threshold is 10%;
.) by default, the take profit per cent is 0.5%;
.) by default, the trailing stop loss per cent is 0.5%;
.) by default, the fast MA length is 50;
.) by default, the slow MA length is 200;
.) by default, the MA used is EMA.
Cheers.
Trailingstoploss
Percent Drop from Highest HighBuy and hold investors may decide to use trailing stops to protect profits and capital from market crashes, especially during bull markets.
The purpose of this indicator is to hep investors to identify a location to place them. The indicator plots the highest high from 'x' bars ago. It then plots a trailing stop loss 'y' percent below that line.
The indicator enables its users to input different 'x' and 'y' values to observe what they think works best for them in different markets.
Users might choose to pair the indicator with trend confirming indicators, such as moving average cross overs, to determine that the market is trending and not ranging.
There is no magic in this indicator, only maths. Like every indicator, it has no ability to predict anything. Just because the market is doing one thing now, it might do something different later. The past does not equal the present nor the future. Make your own decisions and be responsible for them.
All the best to you and your family.
Pinescript v4 - The Holy Grail (Trailing Stop)After studying several other scripts, I believe I have found the Holy Grail! (Or perhaps I've just found a bug with Tradingview's Pinescript v4 language) Anyhow, I'm publishing this script in the hope that someone smarter than myself could shed some light on the fact that adding a trailing stop to any strategy seems to make it miraculously...no that's an understatement...incredulously, stupendously, mind-bendingly profitable. I'm talking about INSANE profit factors, higher than 200x, with drawdowns of <10%. Sounds too good to be true? Maybe it is...or you could hook it up to your LIVE broker, and pray it doesn't explode. This is an upgraded version of my original Pin Bar Strategy.
Recommended Chart Settings:
Asset Class: Forex
Time Frame: H1
Long Entry Conditions:
a) Exponential Moving Average Fan up trend
b) Presence of a Bullish Pin Bar
c) Pin Bar pierces the Exponential Moving Average Fan
Short Entry Conditions:
a) Exponential Moving Average down trend
b) Presence of a Bearish Pin Bar
c) Pin Bar pierces the Exponential Moving Average Fan
Exit Conditions:
a) Trailing stop is hit
b) Moving Averages cross-back (optional)
c) It's the weekend
Default Robot Settings:
Equity Risk (%): 3 //how much account balance to risk per trade
Stop Loss (x*ATR, Float): 0.5 //stoploss = x * ATR, you can change x
Stop Loss Trail Points (Pips): 1 //the magic sauce, not sure how this works
Stop Loss Trail Offset (Pips): 1 //the magic sauce, not sure how this works
Slow SMA (Period): 50 //slow moving average period
Medium EMA (Period): 18 //medium exponential moving average period
Fast EMA (Period): 6 //fast exponential moving average period
ATR (Period): 14 // average true range period
Cancel Entry After X Bars (Period): 3 //cancel the order after x bars not triggered, you can change x
Backtest Results (2019 to 2020, H1, Default Settings):
AUDUSD - 1604% profit, 239.6 profit factor, 4.9% drawdown (INSANE)
NZDUSD - 1688.7% profit, 100.3 profit factor, 2.5% drawdown
GBPUSD - 1168.8% profit, 98.7 profit factor, 0% drawdown
USDJPY - 900.7% profit, 93.7 profit factor, 4.9% drawdown
USDCAD - 819% profit, 31.7 profit factor, 8.1% drawdown
EURUSD - 685.6% profit, 26.8 profit factor, 5.9% drawdown
USDCHF - 1008% profit, 18.7 profit factor, 8.6% drawdown
GBPJPY - 1173.4% profit, 16.1 profit factor, 7.9% drawdown
EURAUD - 613.3% profit, 14.4 profit factor, 9.8% drawdown
AUDJPY - 1619% profit, 11.26 profit factor, 9.1% drawdown
EURJPY - 897.2% profit, 6 profit factor, 13.8% drawdown
EURGBP - 608.9% profit, 5.3 profit factor, 9.8% drawdown (NOT TOO SHABBY)
As you can clearly see above, this forex robot is projected by the Tradingview backtester to be INSANELY profitable for all common forex pairs. So what was the difference between this strategy and my previous strategies? Check my code and look for "trail_points" and "trail_offset"; you can even look them up in the PineScript v4 documentation. They specify a trailing stop as the exit condition, which automatically closes the trade if price reverses against you.
I however suspect that the backtester is not properly calculating intra-bar price movement, and is using a simplified model. With this simplfied approach, the trailing stop code becomes some sort of "holy grail" generator, making every trade entered profitable.
Risk Warning:
This is a forex trading strategy that involves high risk of equity loss, and backtest performance will not equal future results. You agree to use this script at your own risk.
Hint:
To get more realistic results, and *maybe* overcome the intrabar simulation error, change the settings to: "Stop Loss Trail Points (pips)": 100
I am not sure if this eradicates the bug, but the entries and exits look more proper, and the profit factors are more believable.
Profit Maximizer PMaxPMax is a brand new indicator developed by KivancOzbilgic in earlier 2020.
It's a combination of two trailing stop loss indicators;
One is Anıl Özekşi's MOST (Moving Stop Loss) Indicator
and the other one is well known ATR based SuperTrend.
Both MOST and SuperTrend Indicators are very good at trend following systems but conversely their performance is not bright in sideways market conditions like most of the other indicators.
Profit Maximizer - PMax tries to solve this problem. PMax combines the powerful sides of MOST (Moving Average Trend Changer) and SuperTrend (ATR price detection) in one indicator.
Backtest and optimization results of PMax are far better when compared to its ancestors MOST and SuperTrend. It reduces the number of false signals in sideways and give more reliable trade signals.
PMax is easy to determine the trend and can be used in any type of markets and instruments. It does not repaint.
The first parameter in the PMax indicator set by the three parameters is the period/length of ATR.
The second Parameter is the Multiplier of ATR which would be useful to set the value of distance from the built in Moving Average.
I personally think the most important parameter is the Moving Average Length and type.
PMax will be much sensitive to trend movements if Moving Average Length is smaller. And vice versa, will be less sensitive when it is longer.
As the period increases it will become less sensitive to little trends and price actions.
In this way, your choice of period, will be closely related to which of the sort of trends you are interested in.
We are under the effect of the uptrend in cases where the Moving Average is above PMax;
conversely under the influence of a downward trend, when the Moving Average is below PMax.
Built in Moving Average type defaultly set as EMA but users can choose from 8 different Moving Average types like:
SMA : Simple Moving Average
EMA : Exponential Movin Average
WMA : Weighted Moving Average
TMA : Triangular Moving Average
VAR : Variable Index Dynamic Moving Average aka VIDYA
WWMA : Welles Wilder's Moving Average
ZLEMA : Zero Lag Exponential Moving Average
TSF : True Strength Force
Tip: In sideways VAR would be a good choice
You can use PMax default alarms and Buy Sell signals like:
1-
BUY when Moving Average crosses above PMax
SELL when Moving Average crosses under PMax
2-
BUY when prices jumps over PMax line.
SELL when prices go under PMax line.
ATR Trailing Stoploss StrategyI am sharing the strategy version of the indicator used before. It is very simple to use.
These are the settings I use, you can change, test and use as you wish.
Atr Period 5
Highest High Period 10
Multiplier 2.5
It can generate more signals in shorter time frames.
The success rate will be higher in longer time frames.
Guppy Count Back LineThe Guppy Count Back Line was created by Daryl Guppy and is essentially a trailing stop indicator. I have color coded the indicator to tell you if you should go long or short.
This was a special request so let me know if you would like me to write more scripts for other indicators!
ST0PST0P is a kind of a TRAILING STOP LOSS INDICATOR in which users can set up LONG or SHORT trade versions and also can set up a STOP LOSS level by percent % or unit difference.
It tries to solve the problem of stop loss indicators' default BUY or SELL settings and non adjustable stop levels of % and difference change in price levels.
(Will try to make updates to add user defined start bars.)
Kıvanç Özbilgiç
MTF Trailing SL Alerts [QuantNomad]These are alerts for my MTF Trailing SL Strategy.
Entry Long position if all 4 time-frames agree on the long signal.
Exit Long positions when at least 2 time-frames disagree on the long signals.
Entry to Short position if all 4 time-frames agree on Short signal.
Exit from Short positions when at least 2 time-frames disagree on Short signal.
Use "Once Per Bar Close" when creating alerts.
Link to the strategy:
Williams Fractal Trailing StopsUnlike the built-in version, you can configure how many bars it takes to confirm a fractal. This indicator plots all Williams high and low fractals, and a stop line that trails the fractals up and down. Includes long and short stop alerts. You can choose whether the trail flips long-short based on the price being exceeded within a candle or on candle close. This indicator deals only with fractals and doesn't get into the Alligator or anything else.
I've commented it extensively, so that it might be useful for people learning Pinescript. Enjoy!
MTF Trailing SL Strategy [QuantNomad]This is a Multi-Timeframe version of my Trailing SL Strategy.
Few weeks ago I published Trailing SL Strategy. There I used only basic Trailing SL to enter positions.
It worked pretty well so I tried to work on it a bit. I thought what if you can use the same ATR TSL on different timeframes and combine them into one signal.
In this strategy you can use only ATR stops and choose 3 other higher timeframes in addition to your current timeframe.
You'll see Trailing SL plotted on the chart form all these timeframes.
Entry Long position if all 4 time-frames agree on long signal.
Exit Long positions when at least 2 time-frames disagree on long signal.
Entry to Short position if all 4 time-frames agree on Short signal.
Exit from Short positions when at least 2 time-frames disagree on Short signal.
Here is the link to my basic Trailing SL Strategy:
Trailing SL Alerts [QuantNomad]It's alerts version of my Trailing SL strategy:
Use "Once Per Bar" param when creating alerts.
Trailing SL Strategy [QuantNomad]I'm a big fan of simple strategies.
This one is a very simple one. So it consists only from one Trailing SL. When SL is hit, the position is reversed and SL is tracked for a new position.
You can choose one of 3 types of SL:
% of your price
ATR - it is calculated as current ATR * multiplier
Absolute
As you can see even this simple strategy can show pretty good results.
London Breakout with MDX Trailing StopThis indicator aims to aid in using the regular London Breakout strategy, as well as improve on it by adding a trailing stop based on the Mean Deviation Index.
The London Breakout strategy (according to my personal understanding) basically sees the morning before London open as the accumulation or distribution range for large buyers or sellers, and assumes the market will break either above that mornings high or below that mornings low when they start to move price. It is mostly used to trade stock indices and forex.
This indicator plots the morning high and low for each day. The green line is the morning high, and the red line is the morning low. If price moves above the green line (the morning high) it fills that area with a green color. If price moves below the green line (the morning low) it fills that area with a red color. This makes the breakouts easy to spot.
The background color of the chart turns green when the MDX is above 0 (price is more than X times ATR above the mean) and a breakout above the morning high has occurred, and stays green until the opposite happens.
The background color of the chart turns red when the MDX is below 0 (price is more than X times ATR below the mean) and a breakout above the morning high has occurred, and stays green until the opposite happens.
The default for X above is 1.0, but this can be changed in the settings by changing "ATR Multiplier".
The background is always neutral during the morning session since the morning high and morning low are not established yet.
A trailing stop is shown when price is more than X times away from the mean and a breakout has occured. The distance is set using the MDX. The trailing stop uses a separate ATR multiplier though, to make the signal and trailing stop MDX values different, if one likes. The default ATR multiplier for the trailing stop is 1.25, but this can be changed is the settings by changing "ATR multiplier for trailing stop".
When the high or low of a candle breaks the trailing stop, it is moved further away, indicating you have been stopped out, but gives opportunity to use it if you enter again (so it doesn't just disappear).
As an added bonus, take profit levels have been added based on the mornnig range. The take profit distance is set by multiplying the range with a factor. The levels are then plotted that distance from the morning high and morning low.
MDX:
Simple Moving Average - ATR Trailing StopThe old adage goes "Cut losers fast and let the winners run"
With this in mind, this will plot a dynamic trailing stop by subtracting any multiplier of the Average True Range (ATR) from the SMA of your choice.
BEST Trailing Stop StrategyHello traders
Here we go again.... with the second strategy snippet.
Reminder: the first snipper was a Trailing Profit strategy script
What's on the menu?
A trailing stop is designed to protect gains by enabling a trade to remain open and continue to profit as long as the price is moving in the investor's favor.
The order closes the trade if the price changes direction by a specified percentage or dollar amount.
Trigger me I'm famous
I developed many trading strategies in my career and often I've been asked to trigger a trailing-stop once a certain % move has been made.
On the screenshot below, the SL trigger is plotted in maroon.
Once the price goes past that level for the first time, I'll start trailing the trailing stop level.
In other words, when we see a price makes an interesting move in percentage value - we decide to trail the stop for at least not losing any more
All the BEST
Dave
BEST Trailing Take Profit StrategyHello traders
Hope you enjoyed your weekend on my behalf. Was staying home working ... ^^
This is my first strategy educational post I'm doing ever
While I'm generally against posting strategies because it's very easy to fake performance numbers... I cannot prevent myself from sharing a few cool strategy snippets anyway.
So from now on, I'll be sharing a few strategies also - generally not to showcase performance but only to show what pinescript can do.
As once again strategy performance can be faked is so many ways... :)
What's on the menu?
We all know what a trailing-stop is. right? right? Ok... sharing the definition here :)
A trailing stop is designed to protect gains by enabling a trade to remain open and continue to profit as long as the price is moving in the investor's favor. The order closes the trade if the price changes direction by a specified percentage or dollar amount.
But...do you know what a trailing profit is?
Short definition : Well the same but with your profit limit order.
Long definition : A trailing profit is designed to increase your gains by enabling a trade to remain open and continue to profit as long as the price is moving in the investor's favor. The order closes the trade if the price hits the trailing profit level specified percentage or dollar amount.
Some trading strategies used both a trailing stop AND trailing profit. Not making any recommendation here - only sharing what's possible in the realm of trading and pinescripting
Trigger me I'm famous
I developed many trading strategies in my career and often I've been asked to trigger a trailing-stop or trailing-profit once a certain % move has been made.
I integrated here a Take Profit trigger - once hit, it will activate the trailing profit
On the screenshot below, the TP trigger is plotted in orange. Once the price goes past that level for the first time, I'll start trailing the profit level.
In other words, when we see a price makes an interesting move in percentage value - we decide to offset the profit as we concluded that once it reached such distance - then it leads often to more profit
Of course, using only a trailing profit without stop/trailing-stop/invalidation isn't smart and the surest way to kiss goodbye a trading capital and trading and your good mood
See you tomorrow for another strategy snippet
All the BEST
Dave
ATR + Trailing StopsSimple visualisation of Average True Range in Pinescript V4.
The script has two modes: Running and Trailing.
In Running mode, it continuously displays the ATR above and below the price. Specifically, it displays the High and Low price plus and minus the ATR times a user-supplied multiplier. This can be helpful for visualising volatility.
In Trailing mode, it displays the same ATR line, except the line trails until price crosses it. When price crosses it, it flips from long to short or vice-versa.
You could use trailing ATR as a stop loss. Adjust the multiplier and lookback period for your asset and preference.
ATR ChannelsATR Channels help you to identify where to place your stop-loss or trailing stop-loss based on price volatility, according to the Average True Range (ATR).
TRAILING STOP LOSS TO LONG AND SHORT##THIS SCRIPT IS ON GITHUB
This TradingView strategy it is designed to integrate with other strategies with indicators.
It performs a trailing stop loss from entry and exit conditions.
In this strategy you can add conditions for long and short positions.
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.
Also is possible to select the period that strategy will execute the backtest.
The strategy has the following parameters:
+ **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: 03-Aug-2019
+ Pinescript version: 4
## LICENSE
Copyright 2019 Mauricio Pimenta / exit490
Trailing Stop Loss script may be freely distributed under the MIT license .
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