Multi MA Trend Following Strategy TemplateTrend following is one of the better known technical trading strategies. But, which trend should you follow? Today I am sharing with the community a trend following template script that includes a selection of over 20 different trends / regressions. Some of these are in the Pine library, and some have been custom coded and contributed over time by the beloved Pine Coder community.
How it works:
This template will plot any of the 20+ trends that you can select in the settings. The strategy component will buy if the trend line is moving up, and will sell if it moves down. If the line is green that indicates that the trend is higher than the prior bar. If the line is red that indicates that the trend is lower than the prior bar. This script is different from many moving average scripts in that it follows the trend itself and doesn't look for a cross of multiple trends.
How to use it:
When wanting to trend follow an instrument, you can use this template to help identify what approach you might want to take and/or which indicator you might want to use. You can also modify the strategy as you see fit and make use of the 20+ incorporated indicators. Incorporate your trade and risk management strategy, or use it as an indicator.
Disclaimer: Open source scripts I publish in the community are largely meant to spark ideas that can be used as building blocks for part of a more robust trade management strategy. Even though this example script might beat buy and hold over the back-test time-frame, I wouldn't advise using it as a stand-alone strategy without significant additions/modifications to the strategy and risk management functions.
Trend Analysis
Simple scalping strategy for SOLThis is a simple scalping strategy for trading SOL made on top of the Rebalance Oscillator and the Rebalance Bear/Bull market indicators.
It is intended mostly as proof that these two indicators have their benefits even in simpler strategies.
This strategy in particular works well for the Bear months (check Nov. in the data window) but considerably underperforms Buy&Hold for the Bull months.
It tries to do a market operation per candle whenever the candle happens in a buy/sell trading window of the
Rebalance Bear/Bull indicator ().
It always buys/sells the same amount by default (you can set it in the cog menu in the option "Base Crypto Amount To Trade"),
for SOL this is set to 1.0SOL.
This is my first attempt at scalping, it differs slightly from the standards because it does not require fast
response candles or immediate market operations (it can work well with limit trading) and on top of this it also
does not require a stop loss since it uses an indicator that provides the trading windows (surprises can still happen though).
The profit that this strategy tries to take for each buy/sell pair is not configurable and is set at 12% each way when it happens.
Abdoli's Heikin Ashi Smoothed Buy & Sell Strategy Rev.4This simple strategy is just based of a single indicator, my dear Heikin Ashi Smoothed!
Just try and enjoy it ;)
XTZ trading strategy for Bear monthsThis is my 3rd approach into trading XTZ. It is tuned into bear months and needs to work for at least 30 days.
It looks at the rebalance oscillator and bear market indicator and tries to find a position in the market that does not lose money within the month.
Use the cog icon to update the trading window to fit previous months, and check out the data window for its real performance. Do not rely on the Strategy Tester since this strategy is performing only with `strategy.order` making the values of the Strategy Tester irrelevant and inconsistent with its performance.
Simple/Compounded Returns & Drawdowns TableVery excited to bring this script to the public. This is a very useful table that displays the performance of any strategy you give it in a more detailed view. It runs on all timeframes and at any position on the chart with the replay function. It also updates on tick changes. The table consists of three modes: Simple Equity, Compound Equity and Drawdown.
Simple Equity – shows the change in equity for every month and year. It is calculated by finding the difference in initial equity at the beginning of the month/year and the end of the month/year. The table will thus display strategy performance in blocks of time that are not correlated. It is an excellent way to see individual month/year performance from start to finish but it may not represent true change in equity over time. For example, let's assume that 100% of equity is used on every trade for simplicity. If a loss of 50% is made in the first month and a profit of 100% is made in the next month, the strategy will show 50% profit for the year. This aggregate value might be helpful to know for testing purposes, but in reality, the account is actually at break-even for the year (Initial Equity * 0.5 * 2 = Initial Equity).
Compound Equity – shows compounded change in equity for every month and year. It is calculated by finding the difference in starting equity when the strategy is run and equity at the end of the month/year. The table will thus display the true strategy performance – compounded equity at the end of each month/year.
Drawdown – shows max drawdown for every month and year. It is calculated by finding the difference between the highest equity achieved for the month/year and the trough in equity for the same month/year. Notice: strategy tester might have a max drawdown value higher than any of the drawdown values in the table. This is because the strategy tester calculates the difference between the highest and lowest equity for the entire strategy, whereas the table displays drawdowns for months and years only. Sometimes, the max drawdown for the year will also be the max drawdown for the entire strategy; hence the two values will be the same.
To use this table with your own strategy, simply find " PLACE YOUR STRATEGY CODE HERE " at the bottom of the script and place your strategy code there. Special thanks to QuantNomad for the inspiration. As always, please let me know if there are any bugs or if you need some help. Leave a like if you wish!
robotrading linregWhat is Linear Regression?
(English) www.tradingview.com
(English) www.tradingview.com
(Russian) Link
This script
Straight lines show the last linear regression channel. The smooth lines show the coordinates of the same channel in the past. This allows you to backtest this strategy using past prices.
It also makes sure that the linear regression channel is useless for the cryptocurrency market :)
Strategy
The limit order to open a long position is on the bottom line (lime color). Limit order to open a short position is on the top line (red). All positions are closed by a limit order when the central line of the channel is crossed (blue). A limit order is also used to close positions.
For
Do not use in the cryptocurrency market.
Linear trendSimple way how to use Linear Regression for trading.
What we use:
• Linear Regression
• EMA 200 as a trend filter
Logic:
Firstly we make two different linear regression movings as oscillator. For this we need to subtract slow moving from fast moving, so we get the single moving around zero. This is the green/red line which appears on the chart.
The trade open when LR cross over the threshold. The trade close when LR cross under the threshold below. Crossing over the threshold is the same as faster moving cross over slower moving.
Also we use EMA as a filter. The trades would be only when the price is over than EMA 200.
Outside DayThis strategy is taken from Perry Kaufman's book "Trading System and Methods".
You can enter on the direction of the candle, or opposite to it. I find that the opposite tends to yield better results in volatile assets, allowing a better reward to risk ratio. There is no stop loss in this strategy, only a fixed take profit and a time limitation.
pomilaThis video is a detailed video overview of the _CM_Ultimate_MA_MTF_V4 - Multiple Time Frame - V4 Release.
I will post the link to the Indicator within a few minutes after this video goes live on TradingView either in the Link to Related Ideas below, or I'll post a comment below with the link.
Thanks for you patience.
Please Post and feature requests for this indicator below.
P-Signal Strategy & AlertThanks to your advices I removed in this version something that was not necessary for the strategy but added alert and the chart of the current state of the strategy (white 1 - in trade, 0 - out of trade).
Double SupertrendThis strategy is based on a custom indicator that was created based on the Supertrend indicator. At its core, there are always 2 super trend indicators with different factors to reduce market noise (false signals).
The strategy/indicator has some parameters to improve the signals and filters.
TECHNICAL ANALYSIS
☑ Show Indicators
This option will enable/disable the Supertrend indicators on the chart.
☑ Length
The length will be used on the Supertrend Indicator to calculate its values.
☑ Dev Fast
The fast deviation or factor from one of the super trend indicators. This will be the leading indicator for entry signals, as well as for the exit signals.
☑ Dev Slow
The slow deviation or factor from one of the super trend indicators. This will be the confirmation indicator for entry and exit signals.
☑ Exit Type
It's possible to select from 4 options for the exit signals. Exit signals always take profit target.
☑ ⥹ Reversals
This option will make the strategy/indicator calculate the exit signals based on the difference between the given period's highest and lowest candle value (see Period on this list). It's displayed on the chart with the cross. As it's possible to verify in the image below, there are multiple exit spots for every entry.
☑ ⥹ ATR
Using ATR as a base indicator for exit signals will make the strategy/indicator place limit/stop orders. Candle High + ATR for longs, Candle Low - ATR for shorts. The strategy will show the ATR level for take profit and stick with it until the next signal. This way, the take profit value remains based on the candle of the entry signal.
☑ ⥹ Fast Supertrend
With this option selected, the exit signals will be based on the Fast Supertsignal value, mirrored to make a profit.
☑ ⥹ Slow Supertrend
With this option selected, the exit signals will be based on the Slow Supertsignal value, which is mirrored to take profit.
☑ Period
This will represent the number of candles used on the exit signals when Reversals is selected as Exit Type. It's also used to calculate the gradient used on the Fills and Supertrend signals.
☑ Multiplier
It's used on the take profit when the ATR option is selected on the Exit Type.
STRATEGY
☑ Use The Strategy
This will enable/disable the strategy to show the trades calculations.
☑ Show Use Long/Short Entries
Option to make the strategy show/use Long or Short signals. Available only if Use The Strategy is enabled
☑ Show Use Exit Long/Short
Option to make the strategy show/use Exit Long or Short signals (valid when Reversals option is selected on the Exit Type). Available only if Use The Strategy is enabled
☑ Show Use Add Long/Short
Option to make the strategy show/use Add Long or Short signals. With this option enabled, the strategy will place multiple trades in the same direction, almost the same concept as a pyramiding parameter. It's based on the Fast Supersignal when the candle fails to cross and reverses. Available only if Use The Strategy is enabled
☑ Trades Date Start/End
The date range that the strategy will check the market data and make the trades
HOW TO USE
It's very straightforward. A long signal will appear as a green arrow with a text Long below it. A short signal will appear as a red arrow with a text Short above it. It's ideal to wait for the candle to finish to validate the signal.
The exit signals are optional but give a good idea of the configuration used when backtesting. Each market and timeframe will have its own configuration for the best results. On average, sticking to ATR as an exit signal will have less risk than the other options.
☑ Entry Signals
Follow the arrows with Long/Short texts on them. Wait for the signal candle to close to validate the entry.
☑ Exit Signals
Use them to close your position or to trail stop your orders and maximize profits. Select the exit type suitable for each timeframe and market
☑ Add Entries
It's possible to increase the position following the add margin/contracts based on the Add signals. Not mandatory, but may work as reentries or late entries using the same signal.
☑ What about Stop Loss?
The stop-loss levels were not included as a separated signal because it's already in the chart. There are some possible ideas for the stop loss:
☑⥹ Candle High/Low (2nd recommend option)
When it's a Long signal from the entry signal candle, the stop loss can be the Low value of the same candle. Very tight stop loss in some cases, depending on the candle range
☑⥹ Local Top/Bottom
Selecting the local top/bottom as stop loss will give the strategy more room for false breakouts or reversals, keeping the trade open and minimizing noises. Increases the risk
☑⥹ Fast Supertrend (1st recommend option)
The fast supertrend can be used as stop-loss as well. making it a moving level and working close to trail stop management
☑⥹ Fixed Percentage
It's possible to use a fixed risk percentage for the trades, making the risk easier to control and project. Since the market volatility is not fixed, this may affect the accuracy of the trades
☑⥹ Based on the ATR (3rd recommend option)
When the exit type option ATR is selected, it will display the take profit level for that entry. Just mirror that value and put it as stop-loss, or multiply that amount by 1.5 to have more room for market noise.
EXAMPLE CONFIGURATIONS
Here are some configuration ideas for some markets (all of them are from crypto, especially futures markets)
BTCUSDT 15min - Default configuration
BTCUSDT 1h - Length 10 | Dev Fast 3 | Dev Slow 4 | Exit Type ATR | Period 50 | Multiplier 1
BTCUSDT 4h - Length 10 | Dev Fast 2 | Dev Slow 4 | Exit Type ATR | Period 50 | Multiplier 1
ETHUSDT 15min - Length 20 | Dev Fast 1 | Dev Slow 3 | Exit Type Fast Supertrend | Period 50 | Multiplier 1
IOTAUSDT 15min - Length 10 | Dev Fast 1 | Dev Slow 2 | Exit Type Slow Supertrend | Period 50 | Multiplier 1
OMGUSDT 15min - Length 10 | Dev Fast 1 | Dev Slow 4 | Exit Type Slow Supertrend | Period 50 | Multiplier 1
VETUSDT 15min - Length 10 | Dev Fast 3 | Dev Slow 4 | Exit Type Slow Supertrend | Period 50 | Multiplier 1
HOW TO FIND OTHER CONFIGURATIONS
Here are some steps to find suitable configurations
select a market and time frame
enable the Use This Strategy option on the strategy
open the strategy tester panel and select the performance summary
open the strategy configuration and go to properties
change the balance to the same price of the symbol (example: BTCUSDT 60.000, use 60.000 as balance)
go back to the inputs tab and keep changing the parameters until you see the net profit be positive and bigger than the absolute value of the drawdown
in case you can't find a suitable configuration, try other timeframes
Since the tester reflects what happened in the past candles, it's not guaranteed to give the same results. However, this indicator/Strategy can be used with other indicators as a leading signal or confirmation signal.
GRB LongThis strategy generates swing trading signals based on the Golden Ratio Breakout. This is a long-only strategy, entry is breakout and retest of 38.2 fib level and SL is 23.6 fib level from last 21 days. These are only suggestions and NOT recommendations. Please do your own due diligence before taking ANY action. No responsibility for any profits/LOSSES.
Linear Regression Channel Breakout StrategyThis strategy is based on LonesomeTheBlue's Linear Regression Channel Indicator. First of all, I would like to thank LonesomeTheBlue. Breaking the Linear Regression Channel to close the candle triggers a Long or Short signal. If the slope of the Linear Regression Channel is positive, it is Short when it breaks out the lower line, and when the slope is negative, it is Long when it breaks out the upper line. The default is optimized for 8-hour candles, and for other hour candles, find the optimal value yourself. Below is a description of LonesomeTheBlue's Linear Regression Channel.
이 전략은 LonesomeTheBlue의 Linear Regression Channel Indicator를 기반으로 만들어졌습니다. 우선 LonesomeTheBlue님께 감사의 말씀을 드립니다. Linear Regression Channel을 돌파하여 봉 마감하면 Long 또는 Short 신호를 트리거합니다. Linear Regression Channel의 기울기가 양인 경우 하단 라인을 돌파하면 Short이고 그 기울기가 음인 경우 상단 라인을 돌파하면 Long입니다. 기본값은 8시간봉에 최적화 되어 있으며, 다른 시간봉은 직접 최적값을 찾아보십시오. 아래는 LonesomeTheBlue의 Linear Regression Channel에 대한 설명을 퍼왔습니다.
________________________________________________
There are several nice Linear Regression Channel scripts in the Public Library. and I tried to make one with some extra features too. This one can check if the Price breaks the channel and it shows where is was broken. Also it checks the momentum of the channel and shows it's increasing/decreasing/equal in a label, shape of the label also changes. The line colors change according to direction.
using the options, you can;
- Set the Source (Close, HL2 etc)
- Set the Channel length
- Set Deviation
- Change Up/Down Line colors
- Show/hide broken channels
- Change line width
meaning of arrows:
⇑ : Uptrend and moment incresing
⇗ : Uptrend and moment decreasing
⇓ : Downtrend and moment incresing
⇘ : Downtrend and moment decreasing
⇒ : No trend
P-Signal Strategy (BTCUSD Multi Frame)This is an example of constructing P-Signal strategy on a set of probability spaces. In this case, the daily weekly and monthly time frames are used. Please note that the parameters for each of the spaces (the number of bars in the gear) are different.
P-Signal StrategyThis is an example of building a trading strategy based on a p-signal. The p-signal indicates the entropy of the state of the D frame system for the BTCUSD pair in the Kolmogorov probability space.
Combo Backtest 123 Reversal & TEMA1This 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
This study plots the TEMA1 indicator. TEMA1 ia s triple MA (Moving Average),
and is calculated as 3*MA - (3*MA(MA)) + (MA(MA(MA)))
WARNING:
- For purpose educate only
- This script to change bars colors.
RSI + MA StrategyHello, everyone!
We have just released an innovative strategy for TradingView. It allows you to facilitate the trading process when you have to use both indicators.
This strategy is:
User-friendly
Configurable
Equipped with the combination of Relative Strength Index (RSI) and Moving Average (MA) indicators
Designed with all required functions to manage positions
Features
The RSI+MA strategy can:
Identify entry points for Long and Short positions.
Depict RSI and MA values concerning each other.
Reduce visual congestion and import usability thanks to using a combo of 2 indicators.
Allow using pivot trading. The RSI+MA strategy will enter a Long position according to the Short position conditions. And vice versa.
Note! If you want to open a Long position, the RSI line should cross MA from top to bottom. If you want to open a Short position, RSI has to cross MA from bottom to top.
Parameters
We have equipped our strategy with more than 14 additional parameters. So, you can configure the EA according to your needs!
Inputs :
Use Reverse Trade — allows swapping Long and Short positions opening conditions.
Resolution — allows you to view an indicator with data on a higher or lower timeframe on the current chart.
RSI Length
RSI Source: Open, High, Low, Close, HL2, HLC3, OHLC4
Show MA — allows you to enable or disable MA displaying.
MA Length
MA Offset
Style:
RSI — RSI indicator line color and style settings.
MA — MA indicator line color and style configuration.
Upper Band — allows customizing line style, color, and RSI upper bound value.
Lower Band — allows you to customize line style, color, and RSI lower bound value.
Background — background color setting within the RSI upper and lower borders.
Precision — number of decimals for RSI values.
Note! Try RSI+MA on your demo account first before going live.
Bollinger Bands Fibonacci Ratios StrategyHello, everyone!
We have just released an innovative strategy for TradingView. It allows you to identify price pivot points and volatility.
This strategy is:
User-friendly
Configurable
Equipped with Bollinger Bands and smoothed ATR to measure volatility
Features
Thanks to the BB Fibo strategy, you can:
Trade stocks and commodities.
Identify price pivot points.
Choose any band for trading Long or Short positions.
Swap upper and lower bands applying Use Reverse Buy/Sell parameters.
Note! The upper bands are for the Long position. The lower bands are for the Short positions.
Parameters
We have equipped our strategy with more than 14 additional parameters. So, you can configure the EA according to your needs!
Inputs:
Length
Source: Open, High, Low, Close, HL2, HLC3, OHLC4
Offset
Fibonacci Ratio 1 — a Fibonacci factor for the 1st upper and lower indicator lines calculating.
Fibonacci Ratio 2 — a Fibonacci factor for the 2nd upper and lower indicator lines calculating.
Fibonacci Ratio 3 — a Fibonacci factor for the 3d upper and lower indicator lines calculating.
Use Reverse Buy — the strategy will use lower Bollinger bands instead of upper ones.
Fibonacci Buy — band selection for opening Long positions conditions.
Use Reverse Sell — the strategy will use upper Bollinger bands instead of lower ones.
Fibonacci Sell — band selection for opening Short positions conditions.
Style:
Basis — baseline color and style settings.
Upper 3 — the 3d upper line color and style.
Upper 2 — the 2nd upper line color and style.
Upper 1 — the 1st upper line color and style.
Lower 1 — the 1st lower line color and style.
Lower 2 — the 2nd lower line color and style.
Lower 3 — the 3d upper line color and style.
Background — the background color within the 3d upper and 3d lower indicator band.
Precision — the number of decimals for BB Fibo values.
Note! Try BB Fibo on your demo account first before going live.
robotrading ZZ-8 fractalsThis is another version of my ZZ type strategy. This script now uses Bill Williams' fractals.
Strategy
Step 1: Calculate Bill Williams' Fractals
Step 2. A line is drawn from the fractal
Step 3. Create a stop order to enter the position on the line
Trading
If the price is above the lime line, open a long position (and close a short position).
If the price is below the red line, open a short position (and close a long position).
For
"Cryptocurrency / fiat or stablecoins" (BTC/USD, ETH/USDT, etc)
Timeframe 4 hours or more
Simple EMA Crossing Strategy TradeMathSimple EMA Crossing strategy, based on crossover Fast exponential moving average = EMA21 and Slow exponential moving average = EMA55.
Default stop loss is 3%, but you can change it.
Default take profit is 9%, it based on stop loss.
Risk to Reward ratio is 1 to 3.
Strategy was tested on BTCUSDT 1H timeframe and works fine with these parameters.
WhaleCrew BacktesterBacktesting indicators is easy , just add the following line of code to your script:
plot(longEntry ? 1 : shortEntry ? -1 : longTP ? 0.5 : shortTP ? -0.5 : 0, color=na, editable=false, title='Backtest')
These numbers are defined as constants in the backtester source-code.
After adding this indicator to your chart:
1. Open Settings
2. Select supported indicator to backtest
3. Select if you want to enter Longs and/or Shorts
4. Open the 'Strategy Tester' at the bottom to check the performance
Remember:
past performance is not indicative of future results
repainting indicators will create wrong/unrealistic results
DC Breakout Strategy | This is simplicity at its finest.As the title already describes: this is a Donchian breakout strategy. This strategy, as of now, only goes long. It goes long when the price close makes a new high and the 8 day moving average is above the 32 day moving average. The strategy exits the trade if the price breaks the atr trailing stop of * 3 or the 8 day moving average crosses below the 32 day moving average.
This is simplicity at its finest.