Improved simple RSI Buy/Sell at a level (SL/TP)Improved Simple Strategy based on RSI, using overbought or oversold levels.
Backtest: ETHPERP (FTX) - 30m
Set STOP LOSS and GET PROFIT as a percentage (2% and 10% by default).
If strategy.position_size != 0 algorithm convert percentages into points and set stop loss and take profit limit orders.
Simple
3SMA + Ichimoku 2leadlineThis indicator simultaneously displays two lines, which are the leading spans of the Ichimoku Kinko Hyo, and three simple moving averages.
To make it easier to distinguish between the simple moving average line and the line of the Ichimoku Kinko Hyo, the simple moving average line is set to level 2 thickness by default.
Also, the color of Reading Span 1 in the Ichimoku Kinko Hyo has been changed from green to lime to improve color visibility.
I (author of this indicator) use this indicator especially as a simple perspective on the cryptocurrency BTC / USD(USDT).
If this indicator is a problem, moderators don't know about tradingview beginners.
" Visibility " should be a high-priority item not only for indicators but also for graph requirements.
Visibility is one of the most important factors for investors who have to make instant decisions in one minute and one second.
The purpose of this indicator is to display two leading spans that are easily noticed in the Ichimoku cloud and three simple moving averages whose set values can be changed.
This is because chart analysis often uses a combination of a simple moving average of three periods and two lead spans of the Ichimoku cloud.
Also, in chart analysis, green is often displayed with the same thickness on both the moving average line and the Ichimoku cloud.
Therefore, if the moving average line and the Ichimoku cloud often use the same green color, the visibility will drop. Therefore, the green color of Ichimoku cloud was changed to lime color by default.
Tradingview beginners often refer only to the two lines of the leading span of Ichimoku Cloud. Therefore, we decided not to draw lines that are difficult to use.
Many Tradingview beginners don't know that you can change the thickness of the indicator .
Therefore, this indicator shows by DEFAULT the three commonly used simple moving averages that are thickened by one step at the same time.
Also, since the same green color is often used for the Ichimoku cloud and the moving average line, the green color of the preceding span of the Ichimoku cloud is changed to lime color by default.
The originality of this indicator is that it enhances " visibility " so that novice tradingview users will not be confused on the chart screen.
The lines other than the preceding span of the Ichimoku cloud are not displayed, and the moving average line is level 2 thick so that the user can easily see it.
This indicator not only combines a simple moving average and Ichimoku cloud, but also improves "visibility" by not incorporating lines that are difficult to see from the beginning and making it only the minimum display, making it easy for beginners to understand. The purpose is to do.
If any of the other TradingView indicators already meet the following, acknowledge that this indicator is not original.
・Display 3 simple moving averages at the same time
・For visibility, the thickness of the simple moving average line is set to level 2 from the beginning.
・A setting that does not dare to draw lines other than the lead span of Ichimoku cloud.
・Make the moving average line and the Ichimoku cloud line different colors and thicknesses from the beginning.
Exotic SMA Explorations Treasure TroveThis is my "Exotic SMA Explorations Treasure Trove" intended for educational purposes, yet these functions will also have utility in special applications with other algorithms. Firstly, the Pine built-in sma() is exceedingly more efficient computationally on TV servers than these functions will be. I just wanted to make that very crystal clear. My notes elaborate on this in the code blatantly.
Anyhow, the simple moving average(SMA) is one of the most common averaging filters used in a wide variety of algorithms. "Simply put," it's name says a lot about it. The purpose of this script, is to demonstrate variations of it's calculation in a multitude of exotic forms. In certain scenarios our algorithms may require a specific mathemagical touch that is pertinent to our intended goals. Like screwdrivers, we often need different types depending on the objective we are trying to attain. The SMA also serves as the most basic of finite impulse response(FIR) algorithms. For example, things like weighted moving averages can be constructed by using the foundational code of SMA.
One other intended demonstration of this script, is running multiple functions for comparison. I have had to use this from time to time for my own comparisons of performance. Also, imbedded into this code is a method to generically and recklessly in this case, adapt an algorithm. I will warn you, RSI was NEVER intended to adapt an algorithm. It only serves as a crude method to display the versatility of these different algorithms, whether it be a benefit or hinderance concerning dynamic adaptability.
Lastly, this script shows the versatility of TV's NEW additions input(group=) and input(inline=) upgrades in action. The "Immense Power of Pine" is always evolving and will continue to do so, I assure you of that. We can now categorize our input()s without using the input(type=input.bool) hackTrick. Although, that still will have it's enduring versatility, at least for myself.
NOTICE: You have absolute freedom to use this source code any way you see fit within your new Pine projects. You don't have to ask for my permission to reuse these functions in your published scripts, simply because I have better things to do than answer requests for the reuse of these functions. Sufficient accreditation regarding this script and compliance with "TV's House Rules" regarding code reuse, is as easy as copying the functions in their entirety as is. Fair enough? Good!
When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members, I may implement more ideas when they present themselves as worthy additions. Have a profitable future everyone!
Easy TrendThis signal is completely based on analysis and transformation of a single simple moving average. As with all signals and indicators, it should be combined with others.
This is how the signal is built:
1. First it takes the SMA of the closing price.
2. It then takes the ROC of that SMA using a length of 1.
3. It takes an 8-period SMA and also a 64-period SMA of that ROC.
4. These are plotted as follows:
- the ROC is plotted in green when above 0 (trending up) and red when below 0 (trending down).
- the 8-period SMA is plotted as a thin white line within the ROC signal
- the 64-period SMA is plotted as a thick white line within the ROC signal
When the trendline is green, this is a bullish zone. When the trendline is red, this is a bearish zone.
Moving averages (all types of moving averages) are inherently lagging signals. To compensate for that, I am offsetting each SMA series by half of its period. This may be confusing to some, but the end result is a mathematically accurate SMA signal, centered on the signal that it is providing the moving average of. It doesn't stop the lag, but it directly and obviously shows how lagged each signal is, which I personally find better to trade against.
Symbols on the top and bottom of indicator:
Yellow triangle at bottom of indicator shows where a downward trend is starting to bottom out and a buy/long opening may be available soon.
Green triangle at bottom of indicator shows that a downward trend has switched to an upward trend. This indicates a good time to buy.
Yellow triangle at top of indicator shows where an upward trend is starting to plateau and a sell/short opening may be available soon.
Red triangle at top of indicator shows that an upward trend has switched to a downward trend. This indicates a good time to sell.
Note: You may see multiple yellow triangles before seeing a green or red triangle. This can happen when multiple trend accelerations or decelerations occur within an overall green or red zone.
In addition there is a dotted line connecting the end of the 64-period SMA to the end of the 8-period SMA. This indicates the direction the trend is moving towards. When the dotted line crosses the zero line, this portrays a rough estimate of where the trend may switch from a downtrend to an uptrend or vice versa. This is the "best" time to buy or sell, depending on your strategy.
I recommend placing a SMA on your candles set to the same window size as this indicator, and also to offset that SMA to the left by half its window size. For example, a 90-period SMA should be offset by -45 periods. That will cause it to be correctly aligned with this trend signal.
IFR2The IFR2 strategy is based on the RSI indicator.
If the two period RSI is less than the overbought level (25 is the default, but you can configure it to be lower), a long position is placed at the close of the candle. If you are doing it live, you'd have to enter the market ~ 10 minutes before it closes, check the RSI, and buy if it is lower than your overbought level. This generates a discrepancy in the backtesting, but since it is a very small difference, it can be disregarded. Higher overbought levels generate more signals, but they mostly are unreliable. Lower values generates better yields, but they won't occur very often. This strategy is designed to be used in a daily graph, and I don't recommend using it in intraday periods, since you'll make too little money to compensate for the operational cost.
The strategy exits when the high price of two previous candles is reached. If the exit price is higher than the closing price of when you entered, you'll be at a profit, otherwise you'll be at a loss. The exit price is plotted in the graph and it's colors depends on the current open profit: positive values will be green, negative will be red.
This strategy completely disregards the current trend. Long orders will be placed even if you are at a strong down trend. This may seem odd, but you have to keep in mind that this is a volatility based strategy , not a trend following one.
This setup was designed by Alexandre Wolwacz, a.k.a. Stormer.
Reversal closing priceThe reversal closing price (RCP) is a candlestick pattern which follows two simples rules:
the low price of current candle needs to be lower than the low price of the last 2 candles
the closing price of current candle needes to be higher than the closing price of the last candle
This generates a signal for a long position. For a short position, the conditions are inverted:
the high price of current candle needs to be higher than the high price of the last 2 candles
the closing price of current candle needes to be lower than the closing price of the last candle
Since RCP is a trend follower indicator, the strategy is programmed in such a way that long positions are only placed if the short period EMA is above the long period EMA, and short positions are only placed if the short EMA is bellow the long EMA. Both periods are configurable, and should be ajusted for each asset.
This strategy uses a fixed stop loss and take profit, and the it's ratio is configurable. The stop price is one tick lower than the lowest price of X candles prior to the order execution for long positions, while in short positions it's one tick higher than the higher price. The amount of candles to lookback (X) is configurable. Both stop and take profit prices are displayed, the first as a red line, and the second as a green line.
This is the setting that I've found to work best with TVC:SPX , but you may find a better setting. While the RCP is universal, it's placement depends on the trend and it's strenght, something that is very heterogeneous among assets.
I really wish that I was able to place images, but I don't have PRO, so text will have to do.
This strategy was designed by Alexandre Wolwacz, a.k.a. Stormer.
King CobraWith this indicator i tried to create a more clear view of the daily chart.
This indicator only works on the daily chart.
This is how the plotted line is created:
When the 'day close' is greater then the 'day hl2' it plots 1 up 'color = green'
When the 'day close' is lesser then the 'day hl2' it plots 1 down 'color = red'
When the 'day hl2' is greater then the 'previous day hl2' it plots 1 up 'color = green'
When the 'day hl2' is lesser then the 'previous day hl2' it plots 1 down 'color = red'
When value (position) of plotted point is on the same value (position) as previous point it plots the color yellow.
A yellow spot could be position entry or exit.
Enjoy:)
Simple Study for Sean (threshold-triggered alert)This script illustrates how to create simple alerts, triggered by a share price moving above (or below) an arbitrary threshold.
WMA/LSMA - Simplified CalculationsLots of moving averages are based on a weighted sum, the most common ones being the simple (arithmetic) and linearly weighted moving average. The problems with the weighted sum approach is that when your moving average is a FIR filter then the number of operations increase with higher values of length, and when the weights are based on a complex calculation this number of operations can increase drastically!
For the common technical analyst the calculation time of moving averages can be an insignificant factor, even more when using higher time frames, however its always a good practice to seek better performances. The SMA has already a calculation where the number of operations is independent of its length, as such it can be easy to do the same for the linearly weighted moving average (WMA). This post will describe the process toward calculating a simple and efficient WMA which will then be used to provide an efficient calculation of the least squares moving average (LSMA).
Carving Impulses Responses
Remember that impulses responses fully describe the properties of moving averages, the impulse response of the WMA is a linearly decreasing function, so we'll try to calculate it without using a weighted sum. We first need to use a cumulative sum, the cumulative sum can be described as a summation from the first element of a series to the n th element of the series, where n is the current bar number, one could say that this operation is actually super inefficient, however this is not the case, as a cumulative sum can be calculated recursively as follows:
y = y + x
The cumulative sum can be described as an amplifier and posses the following impulse response:
Once the cumulative sum receive the impulse signal as input the result will always be equal to 1. This will form the basis of our simplified calculation, all we need to do transform this response into a linearly decreasing one. The full process is as follows:
Get the impulse response of the cumulative sum
Subtract this response from a linearly increasing impulse response of size length
Normalize the result such that the sum of the resulting response is equal to 1
We need a linearly increasing response of size length , this can be done by using a running sum of the original cumulative sum response, however we must make sure that the value of this response is 0 when the one of the cumulative sum is first equal to 1. Because the resulting response as a maximum value of length we need to multiply our cumulative sum response with length , then we proceed to subtraction.
Finally we need to normalize the result, the sum of a linear sequence of values starting at 1 and ending at n is given by the explicit formula : n(n+1)/2 , which in our case give length*(length+1)/2 , we divide our previous response with this result and we end up with the impulse response of a WMA. This process can be graphically described as follows:
We can then replace the impulse function by the closing price in order to get the WMA of the closing price.
Advantages And Disadvantages
The big advantage of this calculation is its efficiency, in its non functional form (you can see it in the code) the calculation of the WMA only require 9 operations regardless of the value of length against length*2 + 4 for the weighted sum approach, as such both methods are equally efficient in terms of operations as long as the length of a standard WMA is inferior to 3, which is ridiculous, as such our approach is more appropriate.
Another advantage is that Pinescript does not allow for series as length arguments in the WMA function, however here we can have a variable length for the WMA.
Of course there are disadvantages to this approach, in terms of code we require more variables for the non functional form, which create a lengthier scripts. Another disadvantage is that we can be prone to rounding errors due to the cumulative sum, however they shouldn't be significants in our case.
Getting The Least Squares Moving Average
The LSMA is one of my favorite moving averages, and it can derived from a linear combination between the WMA and SMA described as follows : 3WMA - 2SMA. Since we proposed an alternative calculation of the WMA we can then calculate the LSMA without even using the SMA, why ? because the SMA can be calculated by computing the changes over length period of the cumulative sum of an input, this result is then divided by length .
Remember that the impulse response of a cumulative sum is just a rectangular function, all we need is to truncate it such that only length values of the response are equal to 1, this is done thanks to the change function in Pine.
In Summary
A more efficient calculations for both the WMA and LSMA have been presented, while this on itself isn't super important you have learned what is the process toward calculating a filter without relying on a weighted sum.
This calculation will soon be included in the Pinecoders script allowing series as length argument.
Thank you for reading, your interest is always appreciated !
SMA 21/30/50/100/200 with Cross by DragonByteCombines several key simple moving averages into one slot without going overboard. Includes cross indicators between the 50/100 and the 50/200 day SMA's.
Function : Know Sure Thing ! (KST)Firstly : Know Sure Thing, or KST , is a momentum oscillator developed by Martin Pring to make rate-of-change readings easier for traders to interpret. In a 1992 Stocks and Commodities article, Mr. Pring referred to the indicator as "Summed Rate of Change ( KST )," but the KST term stuck with technical analysts. The indicator is relatively common among technical analysts preferring momentum oscillators to make decisions.
References : Investopedia (www.investopedia.com )
Let's start :
Simply :
KST : Above point 0 means long position (positive zone), below point 0 (negative zone) means short position.
I liked this indicator more than RSI because we can evaluate the breaking points of the channels we draw on the indicator according to the regions.
Plus area (positive area), breaking the channel upwards may indicate a very strong rise, and minus area (negative area) the channel downwards may indicate a very strong fall.
As a person who is very keen to identify major trends in advance, I like the KST indicator to approach the target quickly and simply. I also find it very successful in terms of divergences.
CAUTION : This indicator has been written before many times on TV. I have no effort on it. I saved loads only for variable periods. But I have enough experience to say that you are successful in trends with KST . Nevertheless, do not use it alone, as other promoters may benefit.
For example , I divided the standard periods into 4 as in the script. With a correct adaptive period, it has the potential to contribute greatly to accurate moves! You can use with mutable variable periods. Abundant trend lines can be drawn on the indicator and divergences between price and indicator can be sought. Best regards!
Forecasting - Simple Mean MethodThis is a continuation of my series on forecasting techniques. The idea behind the Simple Mean method is to somehow extend historical mean to the future. In this case a forecast equals to last value plus average change.
Kozlod - Simple BB Strategy - XRPBTC - 1 minutePretty good performance of simple BB on XRPBTC 1minute chart.
No SL or PT used.
And remember:
Past performance does not guarantee future results.
Rogers & Satchell Volatility EstimationFirst off, a huge thank you to the following people:
theheirophant: www.tradingview.com
alexgrover: www.tradingview.com
NGBaltic: www.tradingview.com
The Rogers & Satchell function is a volatility estimator that outperforms other estimators when the underlying follows a geometric Brownian motion with a drift (historical data mean returns different from zero). As a result, it provides a better volatility estimation when the underlying is trending. However, the Rogers & Satchell estimator does not account for jumps in price (gaps). It assumes no opening jump. The function uses the open, close, high, and low price series in its calculation and it has only one parameter, which is the period to use to estimate the volatility.
This script allows you to transform the volatility reading. The intention of this is to be able to compare volatility across different assets and timeframes. Having a relative reading of volatility also allows you to better gauge volatility within the context of current market conditions.
For the signal lie I chose a repulsion moving average to remove choppy crossovers of the estimator and the signal. This may have been a mistake, so in the near-future I might update so that the MA can be selected. Let me know if you have any opinions either way.
Want to Learn?
If you'd like the opportunity to learn Pine but you have difficulty finding resources to guide you, take a look at this rudimentary list: docs.google.com
The list will be updated in the future as more people share the resources that have helped, or continue to help, them. Follow me on Twitter to keep up-to-date with the growing list of resources.
Suggestions or Questions?
Don't even kinda hesitate to forward them to me. My (metaphorical) door is always open.
Multiple MACD RSI simple strategySimple strategy script I've had for a while but looks like I never published.
Although it is one of my most simple it seems to have the best profitability. It is pretty rough though. the Stoch RSI has only a little weight to the trade trigger. I'll refine it more over time or you can by all means. Basically the Stoch RSI current K line has to be OVER 40 to trigger a SELL. It has no effect on buy side.
The triggers are roughly as follows:
Year - since so many assets have gone 2x, 3x, 10x+ since 2013 having a strategy that earns a 500% return from 2013 to now isn't that good if buy-and-holding would have got you 800%. This eliminates some of that noise and makes it a little easier to quickly gauge success. So buy/sell trigger need a value of greater or equal to 2018 (default)
MACD 1 - First MACD (short) needs to indicate greater than 0 to buy or less than 0 to sell.
MACD 2 - Same as MACD1 but for second MACD set (long)
Uptrend - Latest close + high divided by last periods close + high needs to be grater than 1. So if latest is 34.30 close and 34.60 high and previous interval is 34.80 close and 34.82 high, that is 0.99 and will not trigger a buy trade.
Downtrend - Same thing but close + low and less than 1.
This script/strategy is pretty rough but if there is interest I'll polish it more since it is a pretty solid but simple strategy for most assets.
Meister Shredder - Simple Moving Averages x4 ForecastIncludes the 21, 50, 100 and 200 SMA and 6 bar forecast
5 Moving Average (Simple / Exponential)Defaults to 1 SMA with 4 EMA bands. 200 SMA is intended to show the trend; 20,40 and 55 EMA show entries; 81 EMA is used as stop/take profit. Defaults are inspired by 'Eric Choe' but you can switch between EMA and SMA as per your own preference. Philakone uses all 5 as EMA 8, 13, 21, 55, 200
15minMAThis script lets you plot a simple or exponential moving average from a specific time frame that you can select. For example, if you always want the Daily 50MA on your chart, regardless of what resolution your chart is on, this will do it. It's also color coded to show if it's rising or falling.
Multiple Moving Averages [clean]Very simple indicator script to display multiple simple moving averages. I know others have made this but they often are too feature-rich and can get cluttered.
Can optionally show a cross when MA 1 crosses MA 3. These are colors such that when MA 1 crosses BELOW MA 3 a red cross is shown, and green when crossing above.