Moving Averages
EMA Slope Trend Follower StrategyThis strategy is based on the slope of the EMA130.
Over that slope, the script calculates two EMAs (9,21) which are used to generate the main entry and exit signal.
In particular, the strategy enters a LONG position when EMA9 > EMA21. On the contrary, it closes the LONG and opens a SHORT when EMA9 < EMA21.
When the slope of the EMA130 is rising, it means that the price is accelerating upwards, fueling an uptrend. Conversely, when the slope is falling, it means that the price is slowing down, falling into a possible downtrend.
Calculating and analyzing two EMAs (fast and slow) over the slope of a medium length EMA instead of the price anticipates a lot the signal. In this way, the strategy never miss a trend.
In order to minimize false positives (entering useless positions), I included two filters, which can be optionally turned on:
- Trend Filter: When the price is above EMA200, the strategy opens ONLY LONG positions. If price < EMA200, only shorts allowed. If the slope gives a long signal and price is below EMA200, for example, the eventual SHORT position is closed, but the LONG entry is postponed to the moment when both conditions (slope uptrending and price > ema200) are met.
I recommend always turning on this filter, as it dramatically decreases drawdown.
- Volatility Filter: When the standard deviation of the last 20 candles is below its 50 samples moving average, no positions are opened, as market is going sideways. The purpose of this filter is to prevent false positives (positions which open and close in a matter of candles due to false signals in sideways market).
I recommend turning on this filter only on low time frames.
This strategy works great on medium time frames (like 4h, 6h, daily), since it spends way less in fees, opening less positions.
It works good on low TFs too (up to 1h, didn't test lower ones), provided Volatility filter is turned on and parameters are set according to the asset.
Commission included in calculations: 0.06% (it's the taker commission on BitMEX with the 10% discount obtainable with any referral link)
Slippage included in calculations: 2 ticks (BitMEX has very liquid order books, and slippage doesn't happen very often unless a huge position size is used).
Hull Suite StrategyConverted the hull suite into a strategy script for easy backtesting and added ability to specify a time periods to backtest over.
Patron04 TOFF MACD DEMA StrategyI prepared the macd dema indicator made by Toff as a startegy test. There is another strategy like this. But the process is opened according to the intersection of macd and signal. But the difference between my test is this. Macd is testing according to the intersection of 0 value. Macd sells 0 when cut down, buying when 0 cuts down
Toff's Macd dema:
Tale Indicators StrategyThis script provides strategy from @JackBauer007 of the slowMA and fastMA crossovers to determine entry and exit conditions.
The default is set to 3EMA and 15EMA crossovers. With entry and exit for Long positions set to high and for Short positions set to low.
You can enable to run the strategy for a selected time-period to analyse the strategy on your instrument.
Credits to @ECHKAY and @JackBauer007 for their inputs and help
T3 ICL MACD STRATEGY
Backtested manually and received approx 60% winrate. Tradingview strategy tester is skewed because this program does not specify when to sell at profit target or at a stop loss.
Uses 1 min for entry and a longer time frame for confirmation (5,10,15, etc..) (Not sure what the yellow arrows are in the picture but they can be ignored)
Ideal Long Entry - The algo uses T3 moving average (T3) and the Ichimoku Conversion Line (ICL) to determine when to enter a long or short position. In this case we are going to showcase what causes the algo to alert long. It first checks to see if the the ICL is greater than T3. Once that condition is met T3 must be green in order to enter long and finally the last closing price has to be greater than the ICL. You can use the MACD to further verify a long trend as well!
Ideal Short Entry - The algo uses T3 moving average (T3) and the Ichimoku Conversion Line (ICL) to determine when to enter a long or short position. In this case we are going to showcase what causes the algo to alert short. It first checks to see if the the ICL is less than T3. Once that condition is met T3 must be red in order to enter short and finally the last closing price has to be less than the ICL. You can use the MACD to further verify a long trend as well!
BTC and ETH Long strategy - version 1I will start with a small introduction about myself. I'm now trading cryto currencies manually for almost 2 years. I decided to start after watching a documentary on the TV showing people who made big money during the Bitcoin pump which happened at the end of 2017.
The next day, I asked myself "Why should I not give it a try and learn how to trade".
This was in February 2018 and the price of Bitcoin was around 11500USD.
I didn't know how to trade. In fact, I didn't know the trading industry at all.
So, my first step into trading was to open an account with a broken. Then I directly bought 200$ worst of BTC . At that time, I saw the graph and thought "This can only go back in the upward direction!" :)
I didn't know anything about Stop loss, Take profit and Risk management.
Today, almost 2 years after, I think that I know how to trade and can also confirm that I still hold this bag of 200$ of bitcoin from 2018 :)
I did spend the 2 last years to learn technical analysis , risk management and leverage trading.
Today (14/05/2020), I know what I'm doing and I'm happy to see that the 2 last years have been positive in terms of gains. Of course, I did not make crazy money with my saving but at least I made more than if I would have kept it in my bank account.
Even if I like trading, I have a full time job which requires my full energy and lots of focus, so, the biggest problem I had is that I didn't have enough time to look at the charts.
Also, I realized that sometimes, neither technical analysis , nor fundamentals worked with crypto currency (at least for short time trading). So, as I have a developer background I decided to try to have a look at algo trading.
The goal for me was neither to make complex algos nor to beat the market but just to automate my trading with simple bot catching the big waves.
I then started to take a look at TV pine script and played with it.
I did my first LONG script in February 2020 to Long the BTC Market. It has some limitations but works well enough for me for the time being. Even if the real trades will bring me half of what the back testing shows, this will still be a lot more than what I was used to win during the last 2 years with my manual trading.
So, here we are! Below you will find some details about my first LONG script. I'm happy to share it with you.
Feel free to play with it, give your comments and bring improvements to it.
But please note that it only works fine with the candle size and crypto pair that I have mentioned below. If you use other settings this algo might loose money!
- Crypto pairs : XBTUSD and ETHXBT
- Candle size: 2 Hours
- Indicator used: Volatility , MACD (12, 26, 7), SMA (100), SMA (200), EMA (20)
- Default StopLoss: -1.5%
- Entry in position if: Volatility < 2%
AND MACD moving up
AND AME (20) moving up
AND SMA (100) moving up
AND SMA (200) moving up
AND EMA (20) > SAM (100)
AND SMA (100) > SMA (200)
- Exit the postion if: Stoploss is reached
OR EMA (20) crossUnder SMA (100)
Here is a summary of the results for this script:
XBTUSD : 01/01/2019 --> 14/05/2020 = +107%
ETHXBT : 01/01/2019 --> 14/05/2020 = +39%
ETHUSD : 01/01/2019 --> 14/05/2020 = +112%
It is far away from being perfect. There are still plenty of things which can be done to improve it but I just wanted to share it :) .
Enjoy playing with it....
Schaff Trend Cycle + Double MAThis strategy uses two different moving averages to determine a trend. It opens a position on a pullback from a trend.
Conditions for buy signal are:
►Crossover out of Shaff Trend Cycle's extreme levels
►The price is above its short period exponential moving average.
►A short period exponential moving average is above a long period exponential moving average.
*Conditions for sell are the opposite.
All in all, I don't think it needs to be on your chart but it can be optimized and even successful on some timeframes.
Shaff Trend Cycle solution was provided by @everget, I converted his script to Pine v.4, added exponential averages and created an algorithm for backtesting.
Mathias & Christer Timeframe RSIThis strategy is based on High and low RSI.
If RSI is => 80 and RSI drops enter Sell position
If RSI is =< 20 anr RSI goes up enter Buy position.
as exit I use MA crosses
MA short (30)
MA Long (50)
Mathias & Christer EMASo this Strategy is my first at when writing it's not 100% finnished.
The strategy idé builds on EMA (9) being clearly over/under the EMA for some bars.
If the EMA is over this will make a triggerline that when EMA (1) crosses this line it signals a buy/sell.
I don't have a great TP or SL for this yet so as of now I'm only using oposit crossing of close for now.
Colors and indicators:
light green/red - indicates that EMA (9) has been crossed and that a new Triggerline is painted at that candles close position.
dark green/red and Up /down Arrow - indicats that the triggerline has been crossed and an order should be taken here.
green/red squares - are where the order closed.
purple line - EMA (9)
blue line - EMA (1)
MacD 200 Day Moving Average Signal Crossover StrategyThis works on most time frames, but I noticed the 4 hour for BTCUSD on coinbase seems to work well as an example. The strategy is pretty simple. I was inspired by a youtube video that said to backtest their strategy so I did. Most of the time it doesn't work but sometimes it's pretty good as in the case I showed.
Basically, you buy if the MacD crossers over the signal line and the histogram is below 0 and you are above the 200 day moving average. Do the opposite to sell!
Strategy Tester EMA-SMA-RSI-MACDOn Tradingview I never saw a custom adjustable strategy script yet, so this is it,
you can change different things and see if you'll get a good strategy or not
Settings:
First choose the source, you can choose out of:
close, open, high, low, ohlc4, hlc3, hl2
Then choose you strategy: Long & Short, Long only or Short only
Next, choose your entry "Buy/Long" (which is the "close Short position" when "Short"):
- (E)MA 1 > (E)MA 2 (Each can be made ema or sma)
- close above (E)MA 1
- RSI strategy
- macd > signal
- macd > 0
- signal > 0
Then choose your RSI values if needed (for example you want a trigger when EMA 1 > SMA 2
but only if RSI > 60, then change "IF RSI >" from 0 to 60
Next you can choose an extra argument
and even a second argument with Higher Time Frame settings
Under this you can change your (E)MA values as desired (HTF values, MACD and RSI length can be found lower)
All the same with the exit/close (or if "Short", this is your entry)
Again, change everything as you wish
Then comes the RSI length setting, MACD settings and HTF settings, followed by SL/TP settings
(you also can enable/disable SL/TP), and TIME settings (for example you want to know the profit only from this year)
Alerts are provided in next script
Have fun!
SMA STRATEGYIt is a simple strategy to show a possible combination of a simple moving average and Fast-SMA published earlier.
It goes long only when the price is over sma 50 and FSMA and closes the trade when it crosses down FSMA. The same logic is for the shorting.
At this time this strategy does not take in count slow crossing and fuss that needs additional confirmation. I described such cases in Fast SMA script.
The strategy does not repaint. Bars color when a candle closes.
Monthly MA Close Generates buy or sell signal if monthly candle closes above or below the signal MA.
Long positions only.
Inputs:
-Change timeframe MA
-Change period MA
-Use SMA or EMA
-Display MA
-Use another ticker as signal
-Select time period for backtesting
This script is not necessarily written to maximize profits, but to minimize losses.
Although it can outperform 'Buy & Hold' on some occasions when there is a multiple month bearisch trend.
You can optimise this strategy by changing the signal MA inputs.
I would suggest aiming for the best Profit Factor starting from the monthly ("M") setting.
You can always fine-tune the results at a lower timeframe.
The option to use another ticker for providing signals can give you a more stable and unified results.
For example using AMEX:SPY as signal with default parameters gives better results with NASDAQ:AAPL than if you would use NASDAQ:AAPL itself.
I used the anti-repainting function from PineCoders to prevent repainting.
This script is best used for multi-month trading positions & Daily or 4H setting of your chart.
Simple Momentum Strategy Based on SMA, EMA and VolumeA simple, non short selling (long positions only, i.e. buy low and sell high) strategy. Strategy makes use of simple SMA, EMA and Volume indicators to attempt to enter the market at the most optimum time (i.e. when momentum and price are moving upwards). Optimum time is defined mainly by picking best timing for price moves higher based on upwards momentum.
This script is targeted / meant for an average/typical trader or investor. This is why a non short selling approach was selected for optimisation for this strategy because "typpical", "average" traders and investors usually use basic (i.e. minimum fees / free membership) exchanges that would not usually offer short selling functionality (at least without additional fees). The assumption used here is that only advanced and sophisticated traders and investors would pay for advanced trading platforms that enable short selling, have a risk appetite for short selling and thus use short selling as a strategy.
The results of the strategy are:
In an overall roughly bearish market (backward testing from beginning to end of 2018) i.e. the market immediately following the highs of around 20k USD per BTC, this strategy made a loss of £3231 USD on trades of a maximum of 1 BTC per long position.
But in an overall bullish market, it makes a profit of about $6800 USD from beginning of 2019 onwards by trading a maximum of 1 BTC per long position.
NOTE: All trading involves high risk. Most strategies use past performance and behaviour as indicators of future performance and that is not necessarily indicative of future results. Hypothetical or simulated performance results have certain inherent limitations too. One limitation is that unlike an actual performance record, simulated results do not represent actual trading and since the trades have not actually been executed, the results of those trades themselves do not have any influence on actual market results, which in real life they would have had (no matter how minor). Additionally, simulated results may have under or over-compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also, by their nature, designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown.
OathOath consists of 21 and 55 EMA , Commodity Channel Index and Supertrend indicator. It confirms a trend and gives you a signal on a pullback. Original creation worked on 1h EURUSD chart.
Oath is merely a rebrand of my previous Patient Trendfollower strategy. Unlike Patient Trendfollower, Oath has actually a good name and it does not fill your screen with noodles.
►Long setup:
• 21 EMA is above 55 EMA , which is above the Supertrend indicator.
• Commodity Channel Index is an oscillator, which prints into the chart if extreme levels are reached. Green is for a level above 100 or below -100, red is above 140 or below -140 and black is above 180 or below -180.
• If 21 EMA > 55EMA > Supertrend and an oversold signal appear, you can buy into the trend.
• When backtesting on 1h EURUSD , profit target 400 pips worked best with a stop-loss below Supertrend's bottom and the size of your spread. Spread values do not subtract from your profit.
• A picture shows two valid entries.
Further examples can be found in Patient Trendfollower 's description.
Thanks to:
• @everget for providing Supertrend solution.
• Satik FX who hand-tested the system by hand and reported results in this article. He is my main inspiration for creating the complete indicator as one because I want to be able to show and hide it with a single click.
Dazzling BoltsThis is three moving average based strategy focused on trend-following. Targets and stops are set based on ATR. Following image pictures the strategy with all mas plotted:
Buying conditions are:
►A smoothened moving average (red) is above the exponential moving average (yellow)
►An exponential moving average is above simple moving average (black)
►Low five candles ago was still above the exponential moving average
►Low two candles ago reached below the exponential moving average
►Close of the previous candle was above the exponential moving average
►Ema force is disabled or exponential moving average set candles ago (orange) is still above simple moving average now.
If these conditions are met, Dazzling Bolts will always give you a signal. However, it holds only one position at a time and it will not buy again until it is closed or exited.
There are two ways exiting may happen. Smoothened moving average crosses below simple moving average or it reaches value based on your settings of average true range and its multiplier.
Settings 10/76/200/true/50/true/true/5/5 shows perfect results on EURUSD 15m chart but it does not guarantee the results. It is only 62 trades which is barely a useful statistical source. It is also highly optimized which means its settings filters out bad trades that may be bad only because of randomnation rather than set market behaviour. You need to test it on 200 trades + before using.
Super Z strategy - Thanks to Rafael Zioni//Original script
//https://www.tradingview.com/script/wYknDlLx-super-Z/
This is a test for verifying if this interesting study works well.
The author, thanks to him!!!, advise a possible repaint because the script uses security function.
Refer to tradingview.com for more info on repainting:
www.tradingview.com
QUOTE:
We can see repainting in the following cases:
1- Strategies using calc_on_every_tick=true. A strategy with parameter calc_on_every_tick = false may also be prone to repainting, but to a lesser degree.
(this is not the case, ndr).
2- Using security for requesting data from a resolution higher than the resolution of the chart’s main symbol (i.e. do not use ion weelky chart if you set 1440 (1Day) in inputs)
NOTE: Thanks again to Rafael Zioni. If he requires to delete this strategy, I'll do immediately.
Noro's Trend Ribbon StrategyOne moving average ( SMA ) is used. The channel is convened at a moving average rather than prices. Blue is a uptrend. Red is a downtrend.
If the candle has closed above the ribbon - open long (and close short)
If the candle has closed below the ribbon - open short (and close long)
TSI CCI HullThis Strategy is Using TSI and CCI and Hull Moving Average to make swing trades on 1H chart but can be used on any pair and timeframe just change settings to suit (Hull Period mostly)
SMA Cross strategyThis is a simple strategy which is always profitable and trades better than most premium channels and I give it out for free :)
Working very good on ETHUSDT futures on binance :)