Combo Backtest 123 Reversal & Ease of Movement (EOM) 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
This indicator gauges the magnitude of price and volume movement.
The indicator returns both positive and negative values where a
positive value means the market has moved up from yesterday's value
and a negative value means the market has moved down. A large positive
or large negative value indicates a large move in price and/or lighter
volume. A small positive or small negative value indicates a small move
in price and/or heavier volume.
A positive or negative numeric value. A positive value means the market
has moved up from yesterday's value, whereas, a negative value means the
market has moved down.
WARNING:
- For purpose educate only
- This script to change bars colors.
M-oscillator
BEST ATR Stop Multiple StrategyHello traders
Here we go again.... with another strategy snippet.
Reminder: it's an alternative of this Trailing Stop strategy script
Entry logic
The entry is based on a Simple Moving Averages (SMA) cross.
This part doesn't matter here - as I wanted to focus on the ATR multiple stop loss component.
ATR STOP
This strategy snippet uses an entry stop loss defined based on a multiple of the average true range value.
The soure code detects ATR value at entry price, applies the multiplier and will set a static (= non trailing) stop-loss to each position
A pinescript v4 label will appear for each new signal displaying the ATR*multiplier value at signal time
All the BEST
Dave
Pyramiding Strategy To Study [mcristianrios]This script simulates what goes behind scenes in a Strategy and it serves to know in Study mode how many positions are running at the same time.
Combo Backtest 123 Reversal & Dynamo 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
In July 1996 Futures magazine, E. Marshall Wall introduces the
Dynamic Momentum Oscillator (Dynamo). Please refer to this article
for interpretation.
The Dynamo oscillator is a normalizing function which adjusts the
values of a standard oscillator for trendiness by taking the difference
between the value of the oscillator and a moving average of the oscillator
and then subtracting that value from the oscillator midpoint.
WARNING:
- For purpose educate only
- This script to change bars colors.
Combo Backtest 123 Reversal & Dynamic Pivot Point 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
This Pivot points is calculated on the current day.
Pivot points simply took the high, low, and closing price from the previous period and
divided by 3 to find the pivot. From this pivot, traders would then base their
calculations for three support, and three resistance levels. The calculation for the most
basic flavor of pivot points, known as ‘floor-trader pivots’, along with their support and
resistance levels.
WARNING:
- For purpose educate only
- This script to change bars colors.
Combo Backtest 123 Reversal & Dynamic Momentum Index 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
This indicator plots Dynamic Momentum Index indicator. The Dynamic Momentum
Index (DMI) was developed by Tushar Chande and Stanley Kroll. The indicator
is covered in detail in their book The New Technical Trader.
The DMI is identical to Welles Wilder`s Relative Strength Index except the
number of periods is variable rather than fixed. The variability of the time
periods used in the DMI is controlled by the recent volatility of prices.
The more volatile the prices, the more sensitive the DMI is to price changes.
In other words, the DMI will use more time periods during quiet markets, and
less during active markets. The maximum time periods the DMI can reach is 30
and the minimum is 3. This calculation method is similar to the Variable
Moving Average, also developed by Tushar Chande.
The advantage of using a variable length time period when calculating the RSI
is that it overcomes the negative effects of smoothing, which often obscure short-term moves.
The volatility index used in controlling the time periods in the DMI is based
on a calculation using a five period standard deviation and a ten period average
of the standard deviation.
WARNING:
- For purpose educate only
- This script to change bars colors.
Laguerre RSI by KivancOzbilgic STRATEGYBacktesting.
" Laguerre RSI is based on John EHLERS' Laguerre Filter to avoid the noise of RSI .
Change alpha coefficient to increase/decrease lag and smoothness.
Buy when Laguerre RSI crosses upwards above 20.
Sell when Laguerre RSI crosses down below 80.
While indicator runs flat above 80 level, it means that an uptrend is strong.
While indicator runs flat below 20 level, it means that a downtrend is strong. "
Developer: John EHLERS
Author: KivancOzbilgic
Fractal Breakout StrategyFractal
A type of pattern used in technical analysis to predict a reversal in the current trend. A fractal pattern consists of five bars and is identified when the price meets the following characteristics:
1. A shift from a downtrend to an uptrend occurs when the lowest bar is located in the middle of the pattern and two bars with successively higher lows are positioned around it.
2. A shift from an uptrend to a downtrend occurs when the highest bar is located in the middle of the pattern and two bars with successively lower highs are positioned around it.
Why is it ok to backtest on TradingView from now on!TradingView backtester has bad reputation. For a good reason - it was producing wrong results, and it was clear at first sight how bad they were.
But this has changed. Along with many other improvements in its PineScript coding capabilities, TradingView fixed important bug, which was the main reason for miscalculations. TradingView didn't really speak out about this fix, so let me try :)
Have a look at this short code of a swing trading strategy (PLEASE DON'T FOCUS ON BACKTEST RESULTS ATTACHED HERE - THEY DO NOT MATTER). Sometimes entry condition happens together with closing condition for the already ongoing trade. Example: the condition to close Long entry is the same as a condition to enter Short. And when these two aligned, not only a Long was closed and Short was entered (as intended), but also a second Short was entered, too!!! What's even worse, that second short was not controlled with closing conditions inside strategy.exit() function and it very often lead to losses exceeding whatever was declared in "loss=" parameter. This could not have worked well...
But HOORAY!!! - it has been fixed and won't happen anymore. So together with other improvements - TradingView's backtester and PineScript is now ok to work with on standard candlesticks :)
Yep, no need to code strategies and backtest them on other platforms anymore.
----------------
Having said the above, there are still some pitfalls remaining, which you need to be aware of and avoid:
Don't backtest on HeikenAshi, Renko, Kagi candlesticks. They were not invented with backtesting in mind. There are still using wrong price levels for entries and therefore producing always too good backtesting results. Only standard candlesticks are reliable to backtest on.
Don't use Trailing Stop in your code. TradingView operates only on closed candlesticks, not on tick data and because of that, backtester will always assume price has first reached its favourable extreme (so 'high' when you are in Long trade and 'low' when you are in Short trade) before it starts to pull back. Which is rarely the truth in reality. Therefore strategies using Trailing Stop are also producing too good backtesting results. It is especially well visible on higher timeframe strategies - for some reason your strategy manages to make gains on those huge, fat candlesticks :) But that's not reality.
"when=" inside strategy.exit() does not work as you would intuitively expect. If you want to have logical condition to close your trade (for example - crossover(rsi(close,14),20)) you need to place it inside strategy.close() function. And leave StopLoss + TakeProfit conditions inside strategy.exit() function. Just as in attached code.
If you're working with pyramiding, add "process_orders_on_close=ANY" to your strategy() script header. Default setting ("=FIFO") will first close the trade, which was opened first, not the one which was hit by Stop-Loss condidtion.
----------------
That's it, I guess :) If you are noticing other issues with backtester and would like to share, let everyone know in comments. If the issue is indeed a bug, there is a chance TradingView dev team will hear your voice and take it into account when working on other improvements. Just like they heard about the bug I described above.
P.S. I know for a fact that more improvements in the backtesting area are coming. Some will change the game even for non-coding traders. If you want to be notified quickly and with my comment - gimme "follow".
Combo Backtest 123 Reversal & DSS Bressert 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
Double Smoothed Stochastics (DSS) is designed by William Blaw.
It attempts to combine moving average methods with oscillator principles.
WARNING:
- For purpose educate only
- This script to change bars colors.
Trendless MACD Strategy (Trendless Strategy Series -1 )I Try to eliminate the trend of the stock to see a clear version of the indicators. If you have any idea about that topic, you can send a message to me and we can improve this idea together.
Renko Stock DailyHello,
This strategy must be use only for stocks. It doesnt work with FOREX or others..
You must use it only for renko candles
Best regards
Patient Trendfollower (7)(alpha) Backtesting AlgorithmThis is an alpha version of backtesting algorithm for my Patient Trendfollower (7) strategy. It can help you adapt the indicator to other charts than EURUSD. Please bear in mind that price action, volume profiles and supzistences are a catalyst for successful trading, not an indicator. You can get significantly better results if you use these things in your trading and use Trendfollower only as a secondary tool.
Patient Trendfollower Indicator
Thanks belongs to @everget and Satik FX, their contributions are highlighted on an indicator page.
RSI and Smoothed RSI Bull Div Strategy [BigBitsIO]This strategy focuses on finding a low RSI value, then targeting a low Smoothed RSI value while the price is below the low RSI in the lookback period to trigger a buy signal.
Features Take Profit, Stop Loss, and Plot Target inputs. As well as many inputs to manage how the RSI and Smoothed RSI are configured within the strategy.
Explanation of all the inputs
Take Profit %: % change in price from position entry where strategy takes profit
Stop Loss %: % change in price from position entry where strategy stops losses
RSI Lookback Period: # of candles used to calculate RSI
Buy Below Lowest Low In RSI Divergence Lookback Target %: % change in price from lowest RSI candle in divergence lookback if set
Source of Buy Below Target Price: Source of price (close, open, high, low, etc..) used to calculated buy below %
Smoothed RSI Lookback Period: # of candles used to calculate RSI
RSI Currently Below: Value the current RSI must be below to trigger a buy
RSI Divergence Lookback Period: # of candles used to lookback for lowest RSI in the divergence lookback period
RSI Lowest In Divergence Lookback Currently Below: Require the lowest RSI in the divergence lookback to be below this value
RSI Sell Above: If take profit or stop loss is not hit, the position will sell when RSI rises above this value
Minimum SRSI Downtrend Length: Require that the downtrend length of the SRSI be this value or higher to trigger a buy
Smoothed RSI Currently Below: Value the current SRSI must be below to trigger a buy
Combo Backtest 123 Reversal & CMOaDisparity Index 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
The related CMOaDisparity Index article is copyrighted material from Stocks & Commodities Dec 2009
My strategy modification.
WARNING:
- For purpose educate only
- This script to change bars colors.
ATA v4 StrategyAta strategy is include 3 different time frame = MTF
2 different moving average =MA
Oversold/overbought for relative strength index =RSI
Strategy exit for trailing stop loss %2 =TSL
MTF like 1 day, 4h and 5 min, between 2 moving averages like fibo numbers 21 and 34. Also strategy test for oversold up to 60 and overbought under the 25 with RSI. Stratefy exit include trailing stop loss %2 persantage for max. gain. It was created by XMAXPRO. This system is open to development.
Combo Backtest 123 Reversal & Directional Trend Index (DTI) 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
This technique was described by William Blau in his book "Momentum,
Direction and Divergence" (1995). His book focuses on three key aspects
of trading: momentum, direction and divergence. Blau, who was an electrical
engineer before becoming a trader, thoroughly examines the relationship between
price and momentum in step-by-step examples. From this grounding, he then looks
at the deficiencies in other oscillators and introduces some innovative techniques,
including a fresh twist on Stochastics. On directional issues, he analyzes the
intricacies of ADX and offers a unique approach to help define trending and
non-trending periods.
Directional Trend Index is an indicator similar to DM+ developed by Welles Wilder.
The DM+ (a part of Directional Movement System which includes both DM+ and
DM- indicators) indicator helps determine if a security is "trending." William
Blau added to it a zeroline, relative to which the indicator is deemed positive or
negative. A stable uptrend is a period when the DTI value is positive and rising, a
downtrend when it is negative and falling.
WARNING:
- For purpose educate only
- This script to change bars colors.
Combo Backtest 123 Reversal & DiNapoli Detrended Oscillator 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
DiNapoli Detrended Oscillator Strategy
WARNING:
- For purpose educate only
- This script to change bars colors.
Best Supertrend CCI StrategyHello traders
Someone requested the strategy version of the Supertrend CCI indicator
It's a Supertrend not based on candle close but based on a CCI ( Commodity Channel Index )
How does it work?
Bull event: CCI crossing over the 0 line
Bear event: CCI crossing below the 0 line
When the event is triggered, the script will plot the Supertrend as follow
UP Trend = High + ATR * Factor
DOWN Trend = Low - ATR * Factor
This is an alternative of the classical Supertrend based on candle close being above/beyond the previous Supertrend level.
Hope you'll enjoy it and it will improve your trading making you a better trader
Dave
DPO RMA STRATEGYThis strategy uses tradingview's built-in "Detrended Price Osciilator" ( DPO )indicator script.
It takes the average of 6 different fib lookback periods. (55,89,144,233,377,610)
This is plotted in the purple line.
It then takes the RMA of the DPO and uses the RMA's to determine entry points with crossovers and crossunders.
It's an extremely easy indicator to use. You mostly only need to adjust the last 2 inputs (These are the RMA Smoother inputs)
Works well with most any market and with any timeframe.
Works great on Heiken Ashi if you keep orders under 150. But I can't post in heiken ashi format thanks to automated traders complaining to tradingivew that they can't make any money with heiken ashi candles
And then pine coders like this that are embraced with high regard because they realized that they can spam a heiken ashi chart with over 400 trades and magically it has excessive slippage.
Stochastic Pop and Drop by Jake Bernstein v1 [Bitduke]I found a simple strategy by Jake Bernstein, modified it a little and created a strategy with Risk Management System (SL+TP); After that I test it on the different cryptocurrency pairs.
About the Indicator
Basically it's the strategy of 2 indicators: Stochastic Oscillator to define the bias and Average Directional Index to confirm it.
One again, It uses Stochastic Oscillator to define the trading bias. In particular, the trading bias was deemed bullish when the weekly 14-period Stochastic Oscillator was above some default value (in him paper - 50) and rising and vice versa.
Once the trading bias is established, Steckler used the Average Directional Index (ADX) to define a slowdown in the trend. ADX measures the strength of the trend and a move below 20 signals a weak trend.
Modifications
I didn't implement Average Directional Index (ADX) and test just different sources for data, oscillator periods and different levels in relation to the crypto market.
So, it shows good results with two tight thresholds at 55 and 45 level.
The bar chart below the defining the bullish and bearish periods (green and red) and gives a signal to enter the trade (purple bars).
Backtesting
Backtested on XBTUSD , BTCPERP (FTX) pairs. You may notice it shows good results on 3h timeframe.
Relatively low drawdown
~ 10% (from 2019 to date) FTX
~ 22% (4 years from 2016) Bitmex
I backtested on the different altcoin pairs as well, but the results were just not good.
Relatively good results were shown by some index pairs from the FTX exchange ( FTX:SHITPERP ), but I think there is a few data for backtesting to be asure in them.
Bitmex 3h (2017 - 2020) :
i.imgur.com
FTX 3h (2019 - 2020):
i.imgur.com
Possible Improvements
- Regarding trading algorithm it would be good to check with strategy with ADX somehow. Maybe for the better entries
- As for Risk Management system, it can be improved by adding trailing stop to the strategy.
Link: school.stockcharts.com
Trend Balance Point System by Welles WilderThis is the original Trend Balance Point System created by Welles Wilders in 1978, rules can be found in his book New Concepts in Technical Trading Systems.
HA smoothed eliminator v2 This script is published to show the difference between Heiken ASHI and Japanese candlesticks. I do not recommend using it in trading. the indicator is taken from here