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.
Oscillators
Pure Stochastic long onlyJust a stochastic for giving you a smart and quick signals of entering and exiting.
Your enter is K>D in the low band and close > last bar's high.
An Ema has been added for targeting and stops.
You exit also in case of high values of K or in case D crosses over K but in the "upper".
Length, periods and level of bands are personalized.
The system goes long only, because it fits at best for shares only; I leave you the attemp of writing code for other classes and for going short, in particular.
SUGGESTIONS:
Keep Oversold period high (> 20, also 40-45)
Keep Emaperiodfast higher (> 5)
MAs & RSI strategy long onlyThis system originates from many articles by Enrico Malverti, Trading System, 2015.
Many trading systems are more stable if you use simple and not so innovative indicators, like exponential moving averages and Relative Strengthe index.
Differently by the original article:
- there is no ATR Filter, but we have introduced a Schaff Indicator. If you have multiple shares/commodities to choose, prefer what has a better value of Schaff;
- there is no fixed stop loss but a second moving average (fast), used as target. There are also Simple Mov Averages on lows (trailing stop loss for long) and a SMA on highs (trailing stop loss for short position).
Be careful, in the system only long case, because being short is not the reverse of being long (as stated in my blog)
SMA on highs are therefore only graphically put.
In this version, I’ve changed the “religious” use of EMAs (“sponsored by” Alexander Elder) to “ordinary” MAs: this because since simple moving averages measure all the factor in addition egual each one, this involve a sort of “offset” in the graph, while EMAs give a major “importance” to the last value (last close itself, you’re already considering): therefore this calculation may be counterproductive.
HOW TO OPERATE
BUY when prices crosses over SMAon long period (we suggest, however, sma long = Sma fast period = no. 11 for italian and european shares)
SELL when
prices go under SMA on lows (7 period), or under on SMA fast!
RSI crosses under level 70 or is higher than 75 (or 80, but in code there is 75)
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.
Rsi, Ema , Ma and Bollinger Bands for 1 min BtcusdtThis is for 1 min Btcusdt pair.
I am tring to find a way to catch %1 ups and downs.
Basicly it buys when rsi low and minute candle closes under ema,ma and lower bollinger band,
it sells when candle goes over upper bb,low ma, when rsi high.
It sells when rsi high ,candle closes over upper bb,over low ma and does the opposite when buying.
I know it's crowded but still tring to learn what to do ^^
I welcome any suggestions to improve.
It works better with shorts for now.
Don't buy with this !! You might lose big !
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
BO - RSI - M5 BacktestingBO - RSI - M5 Backtesting -Rule of Strategy
A. Data
1. Chart M5 IDC
2. Symbol: EURJPY
B. Indicator
1. RSI
2. Length: 12 (adjustable)
3. Extreme Top: 75 (adjustable)
4. Extreme Bottom: 25 (adjustable)
C. Rule of Signal
1. Put Signal
* Rsi create a temporary peak over Extreme Top
row61: peak_rsi= rsi >rsi and rsi >rsi and rsi rsi_top
2. Call Signal
* Rsi create a temporary bottom under Extreme Bottom
row62: bott_rsi= rsi rsi and rsi <rsi_bot
D. Rule of Order
1. Only 1 trade opening
2. Stoploss: No trade open after 1 loss trade each day (number of loss trades adjustable)
3. Expiry: after 6 bars (number of bars adjustable)
GMS: RSI & ROC StrategyThis is a basic strategy like the RSI one I posted. This one adds in the Rate of Change indicator as well.
You can separate the two for RSI only and ROC only. Everything else is the same as the RSI strategy.
- Simple moving average trend filter.
- Simple moving average trade exit.
- Both long and short or each on it's own.
The source code should be open if you want to see it or modify it for your own project. I hope it helps!
Andre
Global Market Signals
GMS: RSI StrategyThis is just a basic RSI strategy that it easy to use and quite comprehensive so you can quickly test out an idea based on RSI.
- I made it comprehensive in that you can select long, short, or both.
- There is a simple moving average trend filter. You can filter for trades above, below, or don't include it at all.
- The exit is based on a simple moving average.
The source code should be open if you want to see it or modify it for your own project. I hope it helps!
Andre
Global Market Signals
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.
kurdistan MACD & RSI & EMA Hello friends
This indicator can help you to combine the three indicators together
EMA (20), MACD (12, 26, 20), RSI (14)
Apply ema20 to rsi as the signal line
Long arrival time
Price above EMA20, MACD above signal line and RSI above signal line
Short arrival time
Price below EMA20, MACD below signal line and RSI below signal line
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.