First script to be optimizedPlease, if you can help me to set stop-loss and take-profit rules based on prices and not on ticks, please comment that!
Oscillators
RSI Strategy - TannerHello everyone, this is my first script on TV. I have done some research on cryptocurrency strategies and much of which has been in technical indicators by combining trend and momentum analysis together. Pine Script is quite a difficult language to learn as opposed to Python.
Anyways, I made some adjustments for the RSI strategy to include a stop loss/take profit and added indicators upon the first initial overbought and oversold levels(70 and 30 respectively). Please DO give me advice or recommendations. Primarily, I am confused as to what metric the stop loss and take profit parameters are using as they do not change when the values are changed in the input. I am unable to tell whether the strategy repaints. Could someone explain why repainting typically occurs in crossovers?
*DISCLAIMER*
This script is merely to help myself and others learn about the Pine Script language. I would not advise you to use this script for live trading. Thanks!
Trend following with HAThis is my first script and it is basically a MA crossover/under strategy that uses heikin ashi closing prices. I've also used limit orders based on HA opening prices of the previous day for entry which improves the performance. However, this impose a restriction when prices are moving too fast and the algo is unable to enter the trade, resulting in a bad position for a long period, which I believe is preventing this strategy from performing better. Will appreciate any comments/ suggestions to improve this (such as enter market prices the next day when failed to enter on HA price - not sure if this is possible) as I'm still starting out and will be more than happy to learn from the community here. Cheers!
CMARSI Strategy (on ETHUSD) Seems working goodthere it is, it's using the Connor RSI with little variations.
C onnor M oving A verage RSI
TFS: Volume Oscillator Backtest This is the second part of TFS trading strategy. The concept of this
indicator is similar to that of On-Balance Volume indicator (OBV). It
is calculated according to these rules:
If Close > Open, Volume is positive
If Close < Open, Volume is negative
If Close = Open, Volume is neutral
Then you take the 7-day MA of the results.
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
Stochastic RSI Backtest This strategy used to calculate the Stochastic RSI
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
Smoothed RSI Backtest ver.2 This is new version of RSI oscillator indicator, developed by John Ehlers.
The main advantage of his way of enhancing the RSI indicator is smoothing
with minimum of lag penalty.
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
Smoothed RSI Backtest This is new version of RSI oscillator indicator, developed by John Ehlers.
The main advantage of his way of enhancing the RSI indicator is smoothing
with minimum of lag penalty.
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
SMI Ergodic Oscillator Backtest ver.2 The SMI Ergodic Indicator is the same as the True Strength Index (TSI) developed by
William Blau, except the SMI includes a signal line. The SMI uses double moving averages
of price minus previous price over 2 time frames. The signal line, which is an EMA of the
SMI, is plotted to help trigger trading signals. Adjustable guides are also given to fine
tune these signals. The user may change the input (close), method (EMA), period lengths
and guide values.
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
WARNING:
- For purpose educate only
SMI Ergodic Oscillator Strategy ver.2 The SMI Ergodic Indicator is the same as the True Strength Index (TSI) developed by
William Blau, except the SMI includes a signal line. The SMI uses double moving averages
of price minus previous price over 2 time frames. The signal line, which is an EMA of the
SMI, is plotted to help trigger trading signals. Adjustable guides are also given to fine
tune these signals. The user may change the input (close), method (EMA), period lengths
and guide values.
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
WARNING:
- For purpose educate only
SMI Ergodic Oscillator Backtest The SMI Ergodic Indicator is the same as the True Strength Index (TSI) developed by
William Blau, except the SMI includes a signal line. The SMI uses double moving averages
of price minus previous price over 2 time frames. The signal line, which is an EMA of the
SMI, is plotted to help trigger trading signals. Adjustable guides are also given to fine
tune these signals. The user may change the input (close), method (EMA), period lengths
and guide values.
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
RSI based on ROC Backtest This is the new-age indicator which is version of RSI calculated upon
the Rate-of-change indicator.
The name "Relative Strength Index" is slightly misleading as the RSI
does not compare the relative strength of two securities, but rather
the internal strength of a single security. A more appropriate name
might be "Internal Strength Index." Relative strength charts that compare
two market indices, which are often referred to as Comparative Relative Strength.
And in its turn, the Rate-of-Change ("ROC") indicator displays the difference
between the current price and the price x-time periods ago. The difference can
be displayed in either points or as a percentage. The Momentum indicator displays
the same information, but expresses it as a ratio.
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
Reverse Engineering RSI, by Giorgos Siligardos Backtest The related article is copyrighted material from
Stocks & Commodities.
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
Relative Volatility Index Backtest The RVI is a modified form of the relative strength index (RSI).
The original RSI calculation separates one-day net changes into
positive closes and negative closes, then smoothes the data and
normalizes the ratio on a scale of zero to 100 as the basis for the
formula. The RVI uses the same basic formula but substitutes the
10-day standard deviation of the closing prices for either the up
close or the down close. The goal is to create an indicator that
measures the general direction of volatility. The volatility is
being measured by the 10-days standard deviation of the closing prices.
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
Relative Momentum Index Backtest The Relative Momentum Index (RMI) was developed by Roger Altman. Impressed
with the Relative Strength Index's sensitivity to the number of look-back
periods, yet frustrated with it's inconsistent oscillation between defined
overbought and oversold levels, Mr. Altman added a momentum component to the RSI.
As mentioned, the RMI is a variation of the RSI indicator. Instead of counting
up and down days from close to close as the RSI does, the RMI counts up and down
days from the close relative to the close x-days ago where x is not necessarily
1 as required by the RSI). So as the name of the indicator reflects, "momentum" is
substituted for "strength".
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
True Strength Indicator BTCUSD 2HScript based on True Strength Index (TSI) and RSI
A technical momentum indicator that helps traders determine overbought and oversold conditions of a security by incorporating the short-term purchasing momentum of the market with the lagging benefits of moving averages. Generally a 25-day exponential moving average (EMA) is applied to the difference between two share prices, and then a 13-day EMA is applied to the result, making the indicator more sensitive to prevailing market conditions.
!!! IMPORTANT IN ORDER TO AVOID REPAITING ISSUES
!!! USE Chart resolution >= resCustom parameter, suggestion 2H
Yellow zones indicates that you can claim position for better profits even before a claim confirmation.
Dark zones indicates areas where RSI shows overbought and oversold conditions.
BTCUSD
Simply Stochastic Backtest This back testing strategy generates a long trade at the Open of the following
bar when the %K line crosses up UpBand line.
It generates a short trade at the Open of the following bar when the %K line
crosses down DownBand line.
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
Bollinger + RSI, Double Strategy Long-Only (by ChartArt) v1.2This strategy uses the RSI indicator together with the Bollinger Bands to go long when the price is below the lower Bollinger Band (and to close the long trade when this value is above the upper Bollinger band).
This simple strategy only places a long, when both the RSI and the Bollinger Bands indicators are at the same time in a oversold condition.
In this new version 1.2 the strategy was simplified even more than before by going long-only, which made the strategy more successful in backtesting than the previous version (that older version also opened short trades).
This strategy does not repaint and was updated to PineScript version 3.
All trading involves high risk; past performance is not necessarily indicative of future results. Hypothetical or simulated performance results have certain inherent limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not actually been executed, the 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 subject to the fact that they are 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.
P.S. For advanced users: If you want also be able to short with the same strategy approach, then please use my older version 1.1:
The Pivot Detector Oscillator Backtest The Pivot Detector Oscillator, by Giorgos E. Siligardos
The related article is copyrighted material from Stocks & Commodities 2009 Sep
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
PFE (Polarized Fractal Efficiency) Backtest The Polarized Fractal Efficiency (PFE) indicator measures the efficiency
of price movements by drawing on concepts from fractal geometry and chaos
theory. The more linear and efficient the price movement, the shorter the
distance the prices must travel between two points and thus the more efficient
the price movement.
You can change long to short in the Input Settings
WARNING:
- For purpose educate only
- This script to change bars colors.
MACD Strategy- Script Example how to use % SL in your script ** Tired of Script showing a trade that you stopped out on but is still long on your script? Not any more**
I used Pine script to create realistic trading scenarios for SL users. Now your scripts will reflect what you see on the order book.
a=0.0
a := (*Insert buy condition*)? close: nz(a )
plot(0.98*a, color= green) //2%SL for BUY
b=0.0
b:= (*Insert Short condition*) ? close: nz(b )
plot(1.02*b, color= red) //2% SL for Short
Please check the script on how to implement this :)