Moving Stop-Loss mechanism + alerts to MT4/MT5"How to code moving stop-loss mechanism", is one of the most often repeating questions in private messages I receive, so just to focus on this mechanism, I made a spin-off from my previous script: TradingView-Alerts-to-MT4-MT5-dynamic-variables-NON-REPAINTING .
The logic here moves the stop-loss each time a trade is running and a new pivot high/low is detected. When such event occurs (UpdateLongStopLoss or UpdateShortStopLoss), stoploss_long or stoploss_short mutable variable is modified. And it needs to be coded inside strategy.exit() line as "stop=stoploss_long" or "stop=stoploss_short". Entries are pretty straightforward - on Stoch crosses.
Last lines of the script show how to wrap information about such updates and send send alerts to MetaTrader via TradingConnector for execution in Forex/indices/commodities/crypto markets via MetaTrader. Please note that "tradeid=" variable must be passed with each alert, to let MetaTrader know which trade to modify. SLMOD, TPMOD are recently added commands, along with BE (as in "move stop-loss to breakeven" - but that's another topic).
Please disregard strategy backtest results, as this script is for coding education purposes only. However, it seems with the stop-loss mechanism enabled, the results are even better, than in original version of the script :)
Strategy
RSI Cross [xaurr]This is simple but profitable rsi cross strategy, to find optimal values you can change rsi and ema periods.
Good Luck!
TradePro's Trading Idea Cipher Divergence EMA Pb StrategyHere I present you on of Trade Pro's Trading Idea: Cipher B+ Divergence EMA Pullback Strategy.
Optimized the crypto pairBTC/USDT in the 30 minute chart.
There is the possibility to switch between short and long positions.
You can choose between 2 different take profit/stop loss types: The Lowest Low/ Highest High Stop Loss/ Take Profit and the ATR Take Profit/ Stop Loss.
-----------------------------------------------------------------------------------
How does the strategy work?
ENTRY
Long
The price must be above the 200 EMA .
The price needs to make a pullback into the 50 EMA .
Right after that, the Cipher B indicator must give a buy signal, it must be below the zero line and the Money Flow cloud must be green.
Short
Contrary to the premise of long positions.
EXIT
Lowest Low/ Highest High Exit
The Lowest Low (long) / highest high (short) serves as the stop loss. The TP is formed on the basis of a factor.
(Long for example: *Lowest Low* multiplied by *Profitfactor* = TP).
ATR Exit
The value of ATR at the time of buying is multiplied by the value entered in "Profit factor ATR" and "Stop factor ATR". As soon as the price reaches this value, it is closed.
Important
The script must be optimized for each coin or currency pair. However, only the values for the profit factor, the stop loss and Lowest Low / Highest High are relevant.
Also, by changing the Chanel Length and the Chanel Average, you can create strong profit changes.
The results of the strategy are without commissions and leverage.
If you have any questions or feedback, please let me know in the comments.
If you need more information about the strategy and want to know exactly how to apply it, check out my profile. There I have created a tutorial for the function of the script.
BTC Volatility Band StrategyThis script/strategy is a pullback system designed for securities with high volatility so naturally Bitcoin is an excellent choice for trading this. This could be used both on a daily chart or on lower timeframes (I found good results on 3hr timeframe but haven't tested it on anything under 1hr).
A volatility band is created by comparing the candle close price of the previous 2 candles and and it uses this change in price to create a moving average. A band is wrapped around the moving average with a standard deviation of 1 for the inner band and 2 for the outer band. If the price is above a pre-set MA (moving average filter) then it is determined we are in an uptrend so the strategy will issue a buy signal when we are in an uptrend and there is a pullback which causes the lower inner deviation band to be spiked, but if the price continues and falls through the outer deviation band then a buy signal will not issue as this detriments that the volatility spike is to great. You can see a spike "buy" event occur on the indicator where the background is coloured green. For a short/sell then there will be a spike on the upper inner band and we are below the pre-set MA filter, for this it shows with red background on the indicator.
The user can change the date range they wish to test, the moving average period for the volatility tracking and the inner and outer band deviations. On BTC I left the inner deviation and outer deviation bands on standard settings but found the 3 period volatility tracking to be good for trading 1 day chart and the 5 period volatility tracking good for the 3hr chart. Since this is not a buy and hold strategy then for trading you would probably want to stick with the most liquid coins so you can get in and out very fast on any exchange. If you wanted to tray this on less volatile markets then changing the inner deviation band to ~0.75 would work okay in various futures markets likely stocks as well. The take profit and stop loss levels are based on a multiple of the trading range looking back the past 7 candles.
Attached result is trading 1 BTCUSDT contract on Binance.
Trade Vertex - Bank Nifty Volume IndicatorNSE:BANKNIFTY
We all know that the value of an Bank Nifty is derived from top banking sector underlying stocks.
The value of Bank Nifty is calculated from free float market capitalization.
Using the same formula, I made an indicator on the bases of weighted volume of each stock.
This indicator will help you to plot Volume on Bank Nifty.
PMax on Rsi w/T3 *Strategy*Profit Maximizer Indicator on RSI with Tillson T3 Moving Average:
PMax uses ATR calculation inside, for this reason users couldn't manage to use PMax on RSI because RSI indicator doesn't have High and Low values in bars, but ATR needs that values. So I personally calculate RSI in a different way to have High and Low values of RSI wrt price bars.
IMPORTANT:
Because of the sudden movements and divergences on RSI , this indicator must firstly optimized for the charts before using. Optimization can be held by users for the meaningful parameters for each chart.
3 parameters are critical when optimizing:
First: Multiplier
Second: Tillson T3 Length
Third: T3 Volume Factor
Says, Kıvanç Özbilgiç. Here's the strategy version for you to backtest & optimize properly.
Enjoy.
Martingale TemplateA template example on how to apply the famous Martingale gambling strategy. When your strategy gets an exit signal for your long position that leaves you without profit, you re-enter on the next entry long condition with double the capital of the previous amount entered with. You keep doubling the amount of capital entered with until you finally exit with a profit. If the strategy isn't sound enough then it could take several attempts and it can take only as much as a dozen tries to eat away at all your capital as the capital required to double on the next entry increases greatly over time by consecutive products of 2.
The strategy used is just a simple moving average crossover, above the moving average is going long, below the moving average is going short. It can be replaced with whatever strategy that you want. The colored vertical bars show long and short positions and exits. The default option on the tick box under the settings show the number of attempts at entering before finally exiting with a profit, the other option shows the amount of capital it took starting from 1.
Know Sure Thing and EMA Strategy by JLXThis is a simple strategy based in Know Sure Thing indicator and an Exponential moving average,
Rules are as follow:
- You can go long when the KST cross signal bellow 0 and price closes above the target EMA
- You can go short when the KST cross signal above 0 and price closes bellow the target EMA
I include a trailing stop loss, default its 0.5%
Hope you enjoy it
EMAC - Exponential Moving Average CrossEMAC - Exponential Moving Average Cross
This strategy is based in part on original 10ema Basic Swing Trade Strategy by Matt Delong: www.tradingview.com
Link to original 10ema Basic Swing Trade Strategy:
This is the Original EMAC - Exponential Moving Average Cross strategy built as a class for reallifetrading dot com and so has all the default settings and has not been optimized. I would not recommend using this strategy with the default settings and is for educational purposes only. For the fully optimized version please come back around the same time tomorrow 6/16/21 for the EMAC - Exponential Moving Average Cross - Optimized
If you have any questions feel free to reach out to me with a comment and I will try to get back to you quickly with a reply.
[francrypto® strategy] 4 EMAs, P.SAR & Vol.Prof. (by kv4coins)(ENG)
This script consists of my own strategy for cryptocurrency (but can be adapted very well for stocks, forex, etc.)
Is a combination of:
- Four Exponentials Moving Average (EMA), configurables: by defect are 10, 21, 55 and 200 periods in yellow, aqua, orange and blue each of them
- Parabolic SAR System (PSAR), configurable
- Volume Profile (that has been developed by kv4coins - he has already authorized me to use it under the same OSS Licence Terms: MPL 2.0), configurable: with another default values and bilingual support for Spanish (SPA)
How it works
1) It is always better to detect specifics candlesticks or patrons: doji , pinbar or inverted pinbar , engulfing bars , morning star or evening star , harami , twizzer bottom or top , etc.
2) The 10 and 21 periods EMA help to identify the short-term behavior
3) The 55 periods EMA can be used like a support or resistance in medium-term, as 200 periods EMA in very long-term
4) It will convenient search for a double cross (10 & 21) or a triple cross (10, 21 & 55) to determine the medium-term change Downtrend to UpTrend (or viceversa)
5) Confirm the change patron with the Parabolic SAR and then identify potencials purchases or sales
6) Use Volume profile to detect potential supports or resistances areas, in order to set stop limit/loss and take profit orders.
Hope this helps!
Cheers,
FRANCRYPTO®
–––––– 0 ––––––
(ESP)
Este script consiste en mi propia estrategia para criptomonedas (pero puede adaptarse muy bien para acciones, forex, etc.)
Es la combinación de:
1) Cuatro Medias Móviles Exponenciales (EMA), configurables: por defecto son de 10, 21, 55 y 200 períodos en amarillo, turquesa, naranja y azul cada una de ellas
2) Sistema Parabolic SAR (PSAR), configurable
3) Perfil de Volumen (que fuera desarrollado por kv4coins - que ya me ha autorizado a su uso bajo las mismas condiciones de la Licencia OSS: MPL 2.0), configurable: con otros valores por defecto y soporte bilingüe para Español (SPA)
Cómo funciona
1) Siempre va a resultar mejor detectar velas japonesas específicas o patrones: doji , martillos o martillos invertidos , velas envolventes , patrón amanecer o atardecer , harami , velas gemelas , etcétera
2) La EMA de 10 y 21 períodos ayudan a identificar el comportamiento de corto plazo
3) La EMA de 55 períodos puede ser usada como un soporte o resistencia de mediano plazo, como así también, la EMA de 200 períodos en el muy largo plazo
4) Será conveniente buscar un doble cruce (10 & 21) o un triple cruce (10, 21 & 55) para determinar un cambio de la tendencia de mediano plazo de bajista hacia alcista (o viceversa)
5) Confirmá el patrón de cambio con la Parabólica de SAR y entonces identificá potenciales compras o ventas
6) Usá el perfil de volumen para detectar las potenciales zonas de soporte o resistencia, principalmente para establecer ordenes stop limit/loss o take profit.
¡Espero que pueda serles de utilidad!
Saludos,
FRANCRYPTO®
[Sidders] MACDEMASAR IndicatorCame across a cool idea for a strategy that couldn't find in the indicator database, so decided to code it up myself for your pleasure.
Indicators consists of 3 indicators: EMA(200) to determine the overall trend, and the MACD & Parabolic SAR to determine entries (and exits).
Long entry contains 4 conditions and is generated when price is above the 200EMA (1), the MACD crosses above the signal line (2), while they are both below 0 line (3) and when the parabolic SAR is below the closing price of the bar (4).
Short entry is build up the same but in reverse: price is below the 200EMA(1), signal line crosses below the MACD line (2), while they are both above the 0 line (3) and when the parabolic SAR is above the closing price of the bar (4).
Place the stoploss on the parabolic SAR dot below/above the candle that created the signal. Profit target 1:1 risk:reward ratio, but can ofcourse be changed according to your risk apetite. Might add automatically drawn SL/TPs in a later update.
Concept behind the strategy should work on all timeframes, but will require proper backtesting. I think with additional filters the strategy can also be way more finetuned and profitable, personally haven't had the time yet to dive into that.
Have also added alerts for your convenience.
Enjoy!
Ichimoku EMA RSI - Crypto only long StrategyHey there!
Here I show you an Ichimoku Cloud Strategy.
I discovered the strategy on a YouTube channel and tried to transfer it as a strategy into a script.
He said in his video that you would make more profit with this strategy than holding the coin.
Tested with the crypto pair ETH/USDT in the four hour chart.
Period: beginning of 2017 until today.
The strategy should also work with foreign exchange. But then the settings have to be adjusted.
There is the possibility to activate two EMA's and a Stochastic RSI .
-----------------------------------------------------------------------------------
How does the strategy work?
ENTRY
The green Ichimoku lead line must above the red Ichimoku lead line - only the two lead lines are activated.
A green candle must closed above the green lead line.
EXIT
A red candle must close below the green Ichimoku lead line.
OPTIONAL ENTRY
EMA
Once you activate the EMA , long positions will only be taken once the EMA1 is above the EMA2.
Thereby I could observe a significant increase of the profit as well as a decrease of the maximum drawdown.
RSI
As soon as you activate the Stochastic RSI , long positions are only taken when the K line is above the D line.
In the future, I may add an oversold - undersold parameter.
The results of the strategy are without commissions and levers.
If you have any questions or feedback, please let me know in the comments.
If you need more information about the strategy and want to know exactly how to apply it, check out my profile.
I wish you good luck with the strategy!
EMA+RSI Pump & Drop Swing Sniper (SL+TP) - StrategyThis is the strategy version of the 'EMA-RSI-Pump-Drop-Swing-Sniper-With-Alerts':
Some additions with this strategy:
~Added Stop loss & Take profit control. In Settings > Inputs if the Stop Loss is at .051 that means it's 5.1% and the Take Profit at .096 is 9.6%. If you wish to remove the TP and SL just change the value to 1.00 and it would be the same as it being 100% TP and SL which is likely to never be hit.
~Added Backtesting by changing the month/date/year in Settings > Inputs
~Added a 2nd EMA line to assist with the long entry signals. I only use this for long entry & exits, though you could use the long exits as Short entries too. I just personally don't do short trading on Bitcoin.
This is using an EMA and RSI with slightly modified settings to give good entry and exit points while looking at Bitcoin. I use this on a 1-hour and 4-hour chart and with other indicators to find good positions to enter a trade or exit if things are turning red.
It's important to know this strategy was made as a request by another user that was using the indicator version. I don't use this as a trading strategy by itself, I use the visuals it gives as a confirmation with other indicators to find the best possible entry and exit positions.
If you click on the EMA line it will color the bars of the chart based on if they are above or below the EMA - This is just visually helpful for me to see the active trend.
Make sure you hover over or click on the EMA line to see the colors of the candles change - it's not visible by default or without doing this.
Yusram Mount MaV - Day MaV CrossOver Strgty
This indicator shows the comparison between the 7-day fast simple average and the monthly slow average of 5 bars. The red line indicates the monthly green and blue lines the daily average. If the Green-Blue line crosses the red upwards, it is a buy signal and the opposite is a sell signal. As soon as it turns green blue without waiting for the sell signal, a sell signal is created. If you are trading fast, you can consider turning green to blue as an opportunity. In the long run, the red intersection can be interpreted as a Stop point.
I hope it will be useful to everyone.
You can also find the strategy indicator with the same name.
I got the name of this indicator from my daughter's name. The meaning of the name Yüsra means "convenience". I hope this indicator will help you.Yüsram Mount HO - Day HO
Intrangle - Straddle / StrangleIntrangle is an indicator to assist Nifty / Bank Nifty Option Writers / Sellers to identify the PE / CE legs to Sell for Straddle and Strangle positions for Intraday.
Basic Idea : (My Conclusion for making this Indicator)
1) Last 10 Years data says Nifty / Bank Nifty More than 66% of times Index are sideways or rangebound (within 1% day) .
2) Mostly, First one hour high and low working as good support and resistance.
Once First one hour complete, this indicator will show Strangle High (CE), Strangle Low (PE) and Straddle (CE/PE).
Straddle:
If you want to do straddle strategy, sell at the money strike (CE/PE) when price comes near to the straddle line (black line),
Strangle:
If you want to do Strangle strategy, sell Strangle High (CE) and Strangle Low (PE) when price comes near to the straddle line (black line). Both Strangle High and Low will be out of the money when price near to the straddle line (black line).
Adjustment: option adjustment to be done based on the price movement. Adjustment purely up to the user / trader.
Note1: If price not comes to near straddle line after first hour, better to stay light…
Note2: If first hour not giving wide High / Low, don’t use strangle strike based on this indicator. Straddle can be done any day with require adjustment / hedge. This Indicator is purely for education purpose, user / trader has to be back-tested before their start using it.
This indicator will work in Nifty / Bank Nifty only. Best Time frames are 3/5/15 Mins. This is purely made for Intraday
Happy Trading 😊
MACD Signal with RSI Indicating StrategyThis strategy looks for MACD signal crossover and RSI confirmation of oversold/overbought condition.
Tune to your crypto/stock for best results using the strategy and sent an alert. Currently set up to use 25% of equity at each buy signal and will sell 1/3 of position at each sell signal. Initial investment is $1000, but adjust as necessary.
Currently tuned to DOGEUSD on 30min chart.
If you like/use/profit, follow me or shoot me a donation. If you are looking for a script design, I can help.
MACD Trendprediction Strategy V1A trend following indicator based on the MACD and EMA. In this case, signals are not generated by crossing the signal lines as with the MACD, but as soon as the distance between the signal lines increases or decreases. A profit factor of 1.6-3.5 is achieved.
Ein Trendfolge-Indikator, auf der Basis des MACD und EMA. Dabei werden Signale nicht wie bei dem MACD per Kreuzung der Signallinien generiert, sondern sobald ein der Abstand der Signallinien zu oder abnimmt.
Bear & Bull Zone Signal StrategySince I love to mix and match, here is something fresh and that actually works on the breakout of Ethereum without losing your ass on lagging indicators.
It blends some of the nice parts of my previous scripts while moving to big boy pants with a twist on the Fibonacci retracement using SMA and EMA at multiple levels to do a sanity check.
Is it too good to be true? Nope, just what happens when a Solution Architect starts messing around with crypto and applies engineering and mathematics to the mix. You get a strategy that really doesn't have high profit losses when you tweak it just the right way.
What's the right tweak you ask?
1. Start with a 30 minute timeframe and set your window start date to the date the market began the bear or bull run
2. Make sure you can see your strategy performance window (not the graph one)
3. Set Stop Loss and Target Profit to 50%
4. Use your mouse wheel or up and down arrows and mess around with the RSI, go down one at a time but no lower than 7. Whichever value displayed the highest long or short gain is the one to pick.
5. Now select long or short only based on whichever one shows the highest gain.
6. Now go to K and D, leave K as 3 and check what happens when D is 4 or 5. Leave D at the value that gives you the highest gain.
7. Now go to EMA Fast and Slow Lengths. Leave Fast at 5 and check what happens when the Slow is moved up to 11 or 12, do the gains go up. If not, check what happens when Slow is moved down to 9, 8, or 7. Whichever gives you the highest gain, leave it there. Now go mess with the fast length, keep in mind that fast must always be less than slow. So check values down to 3 and up to 6. Same concept, mo money...leave it be.
8. Now go mess with the Target Profit, I start at 5, hit enter, then go to 7, hit enter, then 9...up by 2 until I get to 21 to make sure I don't hastily pick a low one and always keep in mind between which values the gain switched from high to low. For example, in this example I published at 11 it was $5k and at 13 it was $3700 for the gains. So after I got up to 21 I went back to 11 and started going up by 0.01 steps until the value dropped, which was at 11.19 so I set it at 11.18.
9. Now stop loss is trickier, you've maximized the gains, which means if you set the stop loss at a low value you will sacrifice gains. Typically by this point your loss is less than 10% with this script. So, my approach is to find the value where the stop loss doesn't change what I've tweaked already. In this example, I did the same start at 5 and go up by 2 and saw that when I went to 17 it stopped changing. So I started going back down by 0.5 and saw at 15.5 the gains went lower again. Now I started going back up in steps of 0.01 and at 15.98 it went back to the high gain I already tweaked for. I kept stop loss there and unleashed the strategy on ETH.
So far so good, no bad trades and it's been behaving pretty well.
Jaws Mean Reversion [Strategy]This very simple strategy is an implementation of PJ Sutherlands' Jaws Mean reversion algorithm. It simply buys when a small moving average period (e.g. 2) is below
a longer moving average period (e.g. 5) by a certain percentage and closes when the small period average crosses over the longer moving average.
If you are going to use this, you may wish to apply this to a range of investment assets using a screener for setups, as the amount signals are low. Alternatively, you may wish to tweak the settings to provide more signals.
Context can be found here:
LINK
Bjorgum SuperScript
Bjorgum Reversal
Bj Reversal uses Tilson moving averages to identify trend changes
Bars change to yellow as bar close crosses the Tilson moving averages. Blue or red is confirmed as the two Tilson averages themselves cross.
Reversal is great for pinpointing trend change often giving the absolute best entry or exit
Its sensitive nature can mean more false signals on some assets
Be sure to use other indicators from the Bjorgum Collection to confirm signals, or use another strategy that fits the asset or time frame being viewed
Bjorgum HEMA Strategy
Hema uses HA smoothed EMAs to identify trend direction
Default EMA lengths are 5,9, and 21 period
Bar Color will change Malibu or Ruby on a cross of BOTH 5 and 9 EMA
The lengths are customizable to whatever lengths the user desires
Rolando Santos True Relative Movement (TRM)
This underrated momentum strategy conceptualized by Rolando Santos uses 2 indicators to give a 3 color scheme
A leading indicator (RSI) is combined with a lagging indicator (TSI) to produce bar colors based on the condition of each indicator
Both indicators in positive territory produce blue bars
Both indicators in negative bias produce yellow bars
If signals are mixed (one up one down) bars become grey
Speed Selection
The Bjorgum speed selector optimizes the strategy based on the users desires or trading style at the touch of a button
Fast setting is better for swing trades - more timely signals, more whipsaw
Slow setting is better for longer holds or more volatile assets - slower signals, smooths out whipsaw
RSI Bar Color
RSI color changes bar color based on user defined RSI values
Buy/ sell signals are typically given on a cross of the 50 level
Speed selector (fast/Slow) automatically changes lengths between Bj RSI (5 period) and a standard RSI (14 period)
Additional capabilities can be mixed and matched from strategies in the "Strategy Override" section
Add-ons include:
Tilson - The moving average system from Bjorgum Reversal can be toggled to couple with another bar color strategy by clicking this button
PSAR - Parabolic Stop and Reverse indicator can help with trend direction, volatility, and stop losses
HEMA - The 3 moving average system from the HEMA strategy can be coupled with any of the other strategies by clicking "Show HEMA"
Bj Arrows - These arrows plot at the bar level to draw attention to when the BJ TSI is "curling" (See profile for Bjorgum TSI and download today)
-Optional "Plotbar Overlay" plots bars with Heikin-Ashi Inputs when toggled
-This allows for the benefits of price smoothing without sacrificing moving average and indicator performance as real close value is still used
-This can also help on short time frames and improve results with crypto! The user must "mute" the main series candles when in use to avoid candle overlap.
-Optional price line as muting main bars will disable the TradingView default price line. The horizontal plot will track the real closing price while in HA mode!
3 EMA Stochastik RSI ATR SL TP only LONGHey there!
Here i will show you the 3 EMA RSI Stochastic Crossover strategy with an ATR SL and TP.
The strategy works as follows:
For long positions, the EMA's must be in the following order:
The 8 E M A must be above the 14 E M A and the 14 E M A must be above the 50 E M A.
The buy signal is given to us by the Stochastic RSI indicators.
The K line must cross the D line above. The following candle must then close above all E M A's.
The stop loss is determined by three times the value of the ATR.
The take profit is determined by two times the value of the ATR.
In this strategy only long positions are traded.
3x SuperTrend Strategy (Mel0nTek) V1This is a triple SuperTrend based strategy for lower time frame trades such as day trades and scalping. I have not seen many strategies that combine multiple SuperTrends so I thought I would publish this one since I put it together and have been quite happy with the results. I have found through testing that the best results are on currency exchange markets such as Crypto or Forex on 1-15 min time frames.
The core idea was inspired by a youtube video put out by Trade Pro:
"Trade Pro - HIGHEST PROFIT Triple Supertrend Trading Strategy Proven 100 Trade Results"
I went ahead and set the defaults to the ones he uses in his video for anyone who wants to try a configuration similar to his. They work pretty well in general, however the EMA, SuperTrend ATR multipliers, and P/L ratio can be tuned/optimized to fit the timeframe/market desired. The video is quite good but not a required watch as I will explain below.
The 200EMA is used as a medium-term trend direction indicator.
- Price closing consistently above the 200EMA means that only long positions should be entered.
- Price closing consistently below 200EMA means that only short positions should be entered.
The 3 SuperTrend indicators should be used as direction confirmation for entries. Typically, price above SuperTrend indicates bullish movement, while price below SuperTrend indicates Bearish movement. However by itself, it is not a great indication to enter/exit positions in my experience. By combining 3 of them with slightly longer periods and increased ATR multipliers, we can get much stronger confirmation of trend direction/strength.
The way they are used in this strategy is such that:
- We only want to enter a position if at least 2 out of 3 SuperTrends are on our side.
- 3/3 SuperTrends on our side is the best case, since we are taking trades WITH momentum/price strength.
- The second farthest SuperTrend from entry price is used as a Stop Loss
SuperTrend being on our side is not the only requirement for an entry however. The probability of success is increased with SuperTrend, and a longer EMA on our side, but we want to be sure that we aren't getting in too late/after the movement has already happened.
So we use Stoch RSI to pick our entries where price is oversold/overbought and reversing. That means the Stoch RSI is above 80, or below 20, and our indication to enter the trade is when the 2 lines cross/begin reversing direction.
So with trend direction on our side, we can get really good entries at these oversold/overbought extremes, especially as it's reversing (Stoch RSI K and D are crossing). This allows us to use the SuperTrend as a support/stop loss on our entry since price should be above it.
Then we just target 1.5x our max loss so that even if we only win 50% of the time, we still make a profit.
The explicit rules of this strategy are as follows:
=== Rules ===
long only
- price above EMA200
short only
- price below EMA200
Stop Loss = 2nd SuperTrend line above (short) or below(long) entry candle
Profit = 1.5x SL/risk (Profit Ratio x Max Loss)
=== Entry Setup ===
LONG
- Stoch RSI below 20, cross up
- at least 2 SuperTrend lines below close
SHORT
- Stoch RSI above 80, cross down
- at least 2 SuperTrend lines above close
P.S. Special thanks to Trade Pro for producing so many quality videos, putting strategy claims to the test, and providing me with so many good ideas I apply to my own strategies.
Simple way to BEAT the market [STRATEGY]This script has been created to demonstrate the effectiveness of using market regime filters in your trading strategy, and how they can improve your returns and lower your drawdowns
This strategy adds a simple filter (A historical volatility percentile filter, an implementation of which can be found on my trading profile) to a traditional buy and hold strategy of the index SPY.
Note, There are other filters that could also be added including a long-term moving average/percentile rank filter/ADX filter etc, to improve the returns further.
The filter closes our long position during periods of volatility that exceed the 95th percentile (or in the top 5% of volatile days) and buys back when the volatility is below 95% rank of the past 100 days
Have included the backtest results since 1993 which is 28 years of data at the time of writing. Comparison of traditional buy and hold with this modified strategy can be found below:
Traditional buy and hold:
Return per year: 7.95 % (ex Dividends)
Total return: 851.1 %
Max drawdown: 50.79 %
'Modified' buy and hold (this script):
Return per year: 9.92 % (ex Dividends)
Total return: 1412.2 %
Max drawdown: 31.57 %
Feel free to use some of the market filters in my trading profile to improve and refine your strategies further, or make a copy and play around with the code yourself. This is just a simple example for demo purposes.