Donchian Channels Trending Breakout StrategyThis script looks for two entry signals. Long is when the previous breakout of the donchian channels was a low, price is above the input EMA, current price is equal or higher than the upper band and we're not in a position yet. Short is the other way around, so previous breakout of the donchian channels was a high, price is below the input EMA, current price is equal or lower than the lower band.
I haven't found a script that does take the previous highs and lows into consideration. Works for any markets in any conditions because the stop loss and profit targets are based on the upper and lower band of the donchian channels, which means the stop loss and profit targets move with the trend.
For more details see the script itself, I wrote a ton of comments.
Moving Averages
Simple Moving Average CrossoverThis strategy uses two moving averages of 21 and 8 to generate buy or sell signal.
This is for purely intraday trades and best use in 15 min time frame
This strategy uses angle/slope of ma to filter out period of sideways movement and only generate signals when the stock starts trending in one direction
How to use this
1) Buy when the buy is generated
2) Sell when the sell is generated
Properties you can tweak to adjust this strategy to your needs are
1) angle -> Adjust this properties to define how much slope would be considered to generate the signals, higher the values lesser the trades generated.
2) atr period-> this is to adjust the atr period
3) ma source -> close is considered as source , you can use open or high or low
Combo Backtest 123 Reversal & Moving Average Envelopes This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
Moving Average Envelopes are percentage-based envelopes set above and
below a moving average. The moving average, which forms the base for
this indicator, can be a simple or exponential moving average. Each
envelope is then set the same percentage above or below the moving average.
This creates parallel bands that follow price action. With a moving average
as the base, Moving Average Envelopes can be used as a trend following indicator.
However, this indicator is not limited to just trend following. The envelopes
can also be used to identify overbought and oversold levels when the trend is
relatively flat.
WARNING:
- For purpose educate only
- This script to change bars colors.
HiLo Extension This Strategy is finding high and low breaks of the day and enter into the trader based on RSI value and time value
1) This strategy is created for Indian Index like Nifty, Bank Nifty and so...
2) Trades are initiate only after 10:15 AM and before 3:10PM
3) High and Low of the day break will be check during the above time frame
4) RSI value will be check (RSI 50)
5) and trade will be initiate
6) Stop loss set as vwma 20...
Note: This Script will work fine in Index future chart not index spot chart...
This is just my idea only... Please back test yourselve, before using it..
Your comments are welcome!
MACD Crossover trend strategy, Long and ShortHey everybody,
This is my first strategy and script I wrote mostly myself. There's tons of content out there to learn how to code in Pinescript and it's exactly what I wanted and needed in this time of my life.
In any case, I made a rather simple MACD crossover strategy that only takes trades in the direction of both EMA and SMA (there are inputs to change the length of the moving averages and lots of other stuff too).
If the MACD line crosses upwards on the signal line, while above the zero point of the histogram and the price is above EMA + SMA , it's a long signal.
If the MACD line cosses downards on the signal line, while below zero on the histogram and the price is below EMA + SMA , it's a short signal.
There are a lot of default variables that make no sense, for basically any symbol you're going to be looking at. You're going to have to adjust the EMA , SMA , backtest date, take profit, stop loss and all that good stuff yourself to find decently profitable parameters.
I made this myself because I couldn't really find a strategy out there that allowed for so much customizing and it's an easy way to get started in Pinescript.
If you have any suggestions, tips or you see a flatout mistake in my code, please let me know. I'm still learning, everyday and I'm enjoying every second of it.
Combo Backtest 123 Reversal & MA Displaced EnvelopeThis is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
Moving Average Displaced Envelope. These envelopes are calculated
by multiplying percentage factors with their displaced expotential
moving average (EMA) core.
How To Trade Using:
Adjust the envelopes percentage factors to control the quantity and
quality of the signals. If a previous high goes above the envelope
a sell signal is generated. Conversely, if the previous low goes below
the envelope a buy signal is given.
WARNING:
- For purpose educate only
- This script to change bars colors.
wtfBUYorSELLffsMultiple timeframe Hull moving averages. 1 Hull period, 3 timeframes.
With Info Panel
This strategy is for any pair but the settings are tuned for DOGEUSDT
It is 3 Hull moving averages crossovers.
The first HMA is taken from the timeframe of the chart.
The second and third HMA's have a setting for TIMEFRAME.
For example the user can have the chart on 15m, 2nd HMA on 60m(1H), 3rd HMA on 240m(1H)
A info panel is on chart with the signal from each timeframe.
The binance (where DOGEUSDT can be traded) commission fee of 0.1% is added to the results.
Adjust the commission fee to suit your broker and pair.
Tuned for trading cryptocurrency Elon Musk has constantly been backing – dogecoin.
SNAP BACK 2.0 Strategy
This strategy is designed to allow you to catch the bounce or "SNAP Back" of an equity that has been in a trend.
1) Once the moving averages are in the order of 200SMA > 50 SMA > 34EMA > 20SMA > 8EMA (or reverse for and uptrend), the strategy is setup.
2) Next you wait for a trigger of the closing price crossing the 8EMA, while there is a desired gap size between the 8EMA and the 20SMA (2-10% of stock value preferred).
3) Exit position based on target profit reached (conservative sell half at 34EMA and engage a trailing stop loss for remainder or set static limit) or price crosses 8EMA or stop loss%
*)This code also allows you to determine your desired backtesting date compliments of alanaster
This code is the product of many hours of hard work on the part of the greater tradingview community. The credit goes to everyone in the community who has put code out there for the greater good.
The idea for the coding came from a video I watched on YouTube presented by TradeStation called Snap Back - thank you guys for the inspiration.
UPDATE: I have coded the other side of the strategy to allow you to take advantage of the same set-up in an uptrend for Short plays. You can turn the up or downsides on, off, or both.
The main intent is to catch the bounces of a falling stock. However, I have found that you can do the inverse and catch the drops in a rising stock (the latter is not as reliable). This also tends to work better on less volatile stocks. I have included a large volume of user defined conditions and display entry and exit conditions on the chart to see how your choices are impacting the script.
Basic SMA 200 StrategyThe SMA 200 basic strategy will be more than familiar to most traders.
This strategy is to stay with the programming language so to say the "Hello World" of trading.
The SMA 200 basic strategy is also one of the simplest strategies in trading. All that is required is the price and a 200 period moving average. Usually the strategy is used in the daily chart.
The rules are as follows:
Entry: A position is opened when the price crosses the moving average 200 from the bottom to the top.
Exit: The position is closed when the price crosses the moving average from top to bottom.
This is a trend following system and was originally used for trading stocks.
In my opinion, trading with the strategy is recommended to every beginner. There are strategies with better performance, but they are much more complicated to implement. And that's where the big advantage of the strategy can be seen.
Beginners are more than overwhelmed at the beginning of their trading career. Often beginners trade in the 5 min chart with 6 different indicators some signals that they have seen in a Youtube video.
Comparable to a beginner driver who immediately gets into a Porsche as his first car.
Beginners should follow simple rules and avoid intraday charts. Above all, you should do the actual work of a trader.A trader does not just press the mouse twenty times a day and then has easily earned 2000 $. A trader tests systems down to the smallest detail, optimizes and tests again, until he has found an almost " waterproof " trading system. The 200 SMA basic strategy is excellent for gaining experience, learning to follow the rules of a system and not to burn your money right away.
With this script you can test how successful the "simplest strategy in the world" would have been in the past.
Small tip: Do not trade Forex with it it will never work. The strategy is made for long trends and you can find them for example in the stock market.
Have fun with it! About a positive feedback I would be very happy of course.
Bollinger bubble | Forex editionBollinger bubble is an edition for forex market. Work better en JPY pairs.
We buy when a candle open & close outside the lower bollingers band and we target the last highest point on the last 10 candles.
And we sell when a candle open & close outside the higher bollingers band we the target the last lowest point on the last 10 candles.
Bollinger bubble | Stock EditionBollinger bubble is an edition for market like CAC40, DJ30, ..
The market are uptrend with the inflation, this edition only buy (you have less risk then sell)
We buy when a candle open & close outside the lower bollingers band and we target the last highest point on the last 10 candles.
TSI HMA CCIHi!
This strategy has TSI and CCI indicators with the CCI being based on a HMA instead of the Price.
There is a number of conditions that must combine to create buy or sell signals, but it is basically a couple of MA crossovers.
The strategy opens new orders on each candle if the conditions are met, Either direction, so it is hedging.
It wont open new orders if there is a floating loss, and so is constantly attempting to hold a floating profit (drawup instead of drawdown)
But It has a StopLoss (set by user) for closing of losing orders, and it closes all orders in basket style when account is in profit to users set amount target profit.
Low commission set to simulate swap but Forex pairs generally dont have commission like the crypto exchanges do. So if you use this on cryptos, remember to increase the commission to your brokers amount.
Crypto users will likely find that because this opens so many orders the commission could erase its profits.
So i recommend this for Forex only, and perhaps, only NZDUSD 4H chart. other pairs, change settings for.
The strategy has settings for testing on target time spans, so you could test it on just Jan-Feb 2020 for example, if you want, or from Jan 2020 to present day.
Have Fun! Open Script for copy/paste/edit/publish your own version :)
Open Close Cross Strategy plus ExplorerOpen Close Cross Strategy plus Explorer
V 1.0
There is a code that can control sensitivity. try to change 'ATR Multiplier' menu
There is a code for prevent 'repaint'. If you want it check 'Forces Non-Repainting' menu
thanks to
PMax Explorer STRATEGY & SCREENER KivancOzbilgic
Open Close Cross Strategy R5 revised by JustUncleL JustUncleL
TEMA Cross BacktestA simple strategy backtest using two Triple Exponential Moving Averages (TEMA) crossing up and down. The default is a 20 TEMA crossing above 60 TEMA generates a long signal. Short signals are turned off by default, but included in the code at the last 2 lines (remove the '//').
Parts of script borrowed from other public scripts.
Multi Moving Average Crossing (by Coinrule)Moving Averages are among the most common trading indicators. They are straightforward to interpret and effective to use.
One of the limitations of using moving averages is they can provide buy and sell signals with a relatively high lag , making it very difficult to spot the lows and tops of the trend.
Moving averages calculated with a low number of periods like the MA9 (the average of the previous nine price periods) react very fast to price moves providing prompt signals. On the other side, more signals may end up with more false-signals and more trades in a loss.
On the contrary, moving averages calculated with a higher number of periods like the MA100 (which considers the previous one hundred price periods) give more reliable signals, but with a delay.
A system catching the crossing of the MA50 over the MA100 is a good compromise for successful long-term strategies. It provides, on average, reliable buy signals.
The Multi Moving Average Crossing Strategy tries to optimize the exit without waiting for the same opposite crossing (MA50 below MA100). It uses the MA9 crossing below the MA50, instead, to spot a better time for selling.
The setup is as follows.
BUY when the Moving Average 50 crosses above the Moving Average 100
SELL when the Moving Average 9 crosses below the Moving Average 50
The higher is the time frame to calculate the Moving Averages, the better is the overall performance of the strategy. The 4-hour (or 6-hour) time frame seems to be the best, even if it results in fewer trades. If you want to trade more still with good results, the 1-hour time is a good compromise.
Advantages of the strategy
This strategy seeks to catch those that are more likely relevant uptrends and close the trade relatively quickly. More trades mean more opportunities. This is especially effective if you run the strategy on all the available coins on the market, as you could do with Coinrule.
Generally, a Multi Moving Averages approach beats the classic crossing strategy involving only two Moving Averages. We backtested a sample of twenty trading pairs to assess the benefits empirically.
The results show that the Multi Moving Average Strategy
outperforms 13 out of 20 times
has 95% higher average return
has 67% higher median return
The strategy assumes each order to trade 30% of the available capital and opens a trade at a time. A trading fee of 0.1% is taken into account.
Triple EMA StrategyThis is my first ever script so any suggestions, recommendations or improvement ideas welcome!
This strategy is an implementation of a standard three exponential moving averages strategy (defaults: EMA1=5, EMA2=20 and EMA3=50 candles). Trades are executed if EMA1 crosses above/below EMA2 and they are both above/below EMA3. In addition, the close of the current candle must be above/below the previous one by at least the number of ticks you specify in the "buffer" parameter (default 150 ticks). This additional check eliminates many bad trades.
There is also a trailing stoploss which comes into play once the price has gone above/below its initial value which it then follows the price with to ensure the trade closes at the highest possible price.
I find this strategy works best on a 15 minute chart but feel free to play around and fine tune the various parameters. If you find a good setup that returns decent profits, I'd be keen to hear it!
Jim's MACDMACD Buy/Sell Strategy
Filters bearish crossovers above the 0 line and bullish crossovers below.
Uses 34 ema to further filter the trades and take only longs above and only shorts below.
Apply at least 2:1 risk to reward ratio to account for losing trades.
Trade at own risk!
Moving Regression Band Breakout strategyFollowing the introduction of the Moving Regression Prediction Bands indicator (see link below), I'd like to propose how to utilize it in a simple band breakout strategy :
Go long after the candle closes above the upper band . The lower band (alternatively, the lower band minus the 14-period ATR or the central line ) will serve as a support line .
Exit as soon as the candle closes below the support line .
To manage the risk of false breakouts, a fixed stop loss is set to the value of the support line at the time of opening a position. When the support line moves above the position opening price, shift the stop loss to breakeven.
The same logic but in reverse applies to short positions.
As an option, it is possible to allow long entries only when the slope of the Moving Regression curve is positive (and short entries when the slope is negative).
Model parameters:
Length and Polynomial Order define the lag and smoothness of the model.
Multiplier specifies the width of the channel.
As the default model parameter values, I set those that I found to provide optimal risk / reward ratio on the daily timeframe (for both trending and range-bound market). However, the settings are very flexible and can be well-adjusted to particular market conditions. Feel free to play around and leave feedback in the comments!
Here's the original Moving Regression Prediction Bands script:
Scalping using RSI 2 indicator with TSLThis strategy 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 trailing stop loss (%) is 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 trailing stop loss per cent is 1%;
.) by default, the fast MA length is 50;
.) by default, the slow MA length is 200;
.) by default, the MA used is EMA.
Cheers.
EMA Cross StrategyThis double EMA crossover strategy aims to illustrate a good strategy design.
It is currently the only published script that:
supports a proper date picker for the backtest period
is able to test in short and long mode only
Combo Backtest 123 Reversal & Martin Pring's Special K This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
Pring's Special K is a cyclical indicator created by Martin Pring.
His method combines short-term, intermediate and long-term velocity
into one complete series. Useful tool for Long Term Investors
Modified for any source.
WARNING:
- For purpose educate only
- This script to change bars colors.