Every single moving average (ALMA, EMA, HMA, KAMA, RMA, SMA...)So you may be looking at the graph and thinking "this is a mess", and I agree.
The purpose of this script is to plot in the same graph every single type of moving average that I could think of, so you can find the ones that are better for your timeframe and for your asset. Once you add it, disable those types that doesn't seem to serve your purpose, until you can select one you like.
The average types are: ALMA, EMA, HMA, KAMA, RMA, SMA, SWMA, VIDYA, VWAP, VWMA, and WMA. Each one is ploted two times (except SWMA and VWAP), one with a short period, and another with a long, both of which you can configure.
Basit Hareketli Ortalama (SMA)
7 EMA 3 SMA with nameplatesScript provides 7 EMA (5 20 50 100 200 500 1000), 3 SMA (200 500 1000) with built-in nameplates for easier navigation. Different colors and widths from the start just to make your initial tuning a bit easier.
Based on Bubsan and Silkheat multicombo, heavily modified, but still huge kudos to guys for the base code.
Modifications: lengths adjusted, on-chart nameplates added, 2 EMA's added, SMA's reduced, static SMA's deleted.
DCA LinesThis is an indicator which shows your position's average price of you started dollar cost averaging 30, 60, 90, 120, 150 and 180 bars ago.
Dollar Cost Averaging (DCA) means buying into a position by investing a fixed sum every bar (for example every day or every week). This way, when the coin of stock goes down, you buy more of the stock.
Some exchanges such as Coinbase, Revolut or River Financial offer this option of entering a position using automatic DCA. It's a kind of "set it and forget it" investment (but you still have to be careful to sell your position into profit).
There are people who DCA into an ETF every week for many years, and so build a position at a very advantageous average price.
CC - Array-meta Consolidated Interval Display (ACID)This script extends my other two Array examples (which I've also provided to you open source):
The Ticker-centric 5m,15m,45m,1h,4h,1d resolution labels using arrays:
And the more Macro VIX,GLD,TLT,QQQ,SPY,IWM 1d resolution labels using arrays:
This script aims to show how to use min/max/avg with Arrays easily. My next example after this will be exploring the usage of variance versus covariance ratios over different periodic interval resolutions. Currently, this is using the following intervals: 5m,15m,45m,1h,4h,1d. It takes these intervals, calculates the values at those resolutions and puts the absolute min and max from the 5 minute to the 1 day resolutions.
It's more of an example of the power that arrays can hold, as all this truly is right now is a min/max bound calculator. The real gem lies in the avg calculators for multiple resoltuions tied into a single label with readable data. Check out the code and let me know what you think. If you need more examples, the other two scripts I mentioned before are also open source.
Using this on intervals of less than 1D sometimes times out, the way I wrote it is memory intensive, may not work for non-pro users.
Thanks!
NONE OF THIS IS FOREWARD LOOKING STATEMENTS, THIS IS NOT A PREDECTIVE ANALYSIS TOOL. THIS IS A RESEARCH ATTEMPT AT A NOVEL INDICATOR. I am not responsible for outcomes using it.
Please use and give criticisms freely. I am experimenting with combining resolutions and comparing covariance values at different levels right now, so let me know your thoughts! The last indicator will likely not be open source, but may be depending on how complex I get.
Multi timeframes 4 SMA'sThis script gives you the possibility to fastly plot 4 SMA's (défault 20, 50, 100 and 200 periods) in the actual TimeFrame and for 4 others timeframes.
In fact, when you're in lower timeframes, you may want to see where highers TF SMA's are without always changing the TF of the chart. This script was created for that.
It's really simply to use, by default only 4 SMA's of the present timeframe are ploted. If you want to check the higher TF SMA's, just tick the lines in the script parameters.
No strategy here, only trying to faster the use of indicators by changing parameters on multiple MA in the same time.
Don't hesitate to leave a comment if you have ideas to improve the script.
Enjoy !
CC - Macro Consolidated Interval Display (MCID)Ever wish you didn't have to rapidly flip between 6 different tickers to get the full picture?
Yeah, me too. Do you also wish that you kind of understood how the shift / unshift function works for arrays?
Yeah, I did too. Both of those birds are taken care of with one stone!
The Macro Consolidated Interval Display uses the new Array structure and security to display data for VIX, GLD, TLT, QQQ, SPY and IWM (at a 1D interval) SIMUTANEOUSLY! Regardless of which ticker you're looking at you can get the full picture of macro futures data without flipping around to get it.
This is my first script trying to use arrays. It basically shows the following a 1d interval:
ATR14, RSI7, RSI14, SMA50, SMA200 and VWAP for VIX.
ATR14, RSI7, RSI14, SMA50, SMA200 and VWAP for GLD.
ATR14, RSI7, RSI14, SMA50, SMA200 and VWAP for TLT.
ATR14, RSI7, RSI14, SMA50, SMA200 and VWAP for QQQ.
ATR14, RSI7, RSI14, SMA50, SMA200 and VWAP for SPY.
ATR14, RSI7, RSI14, SMA50, SMA200 and VWAP for IWM
To make it more or less busy, I've allowed you to toggle off any of the levels you wish. I've also chosen to leave this as open source, as it's nothing too experimental, and I hope that it can gain some traction as an Array example that the public can use! If you don't like the different values that are shown, use this source code example as a spring-board to put values that you do care about onto the labels.
If this code has helped you at all please drop me a like or some constructive criticism if you do not think it's worth a like.
Good luck and happy trading friends. This should be compatible with my CID as well:
If this gets traction, I will post something similar for a dynamic combination of tickers and intervals that you can set yourself.
JBravo SwingThis follows Johnny Bravo Dominate Stocks strategy. When full price bar closes above SMA 9, this indicates a buy. When price bar closes below EMA20, this indicates a sell. If the MAs are all sloping up and aligned in order 9,20,180, then this indicates a Strong Buy. If the MAs are all sloping down and aligned in order 180,20,9, then this indicates a Strong Sell.
BTC Volume Contango IndexBased on my previous script "BTC Contango Index" which was inspired by a Twitter post by Byzantine General:
This is a script that shows the contango between spot and futures volumes of Bitcoin to identify overbought and oversold conditions. When a market is in contango, the volume of a futures contract is higher than the spot volume. Conversely, when a market is in backwardation, the volume of the futures contract is lower than the spot volume.
The aggregate daily volumes on top exchanges are taken to obtain Total Spot Volume and Total Futures Volume. The script then plots (Total Futures Volume/Total Spot Volume) - 1 to illustrate the percent difference (contango) between spot and futures volumes of Bitcoin. This data by itself is useful, but because aggregate futures volumes are so much larger than spot volumes, no negative values are produced. To correct for this, the Z-score of contango is taken. The Z-score (z) of a data item x measures the distance (in standard deviations StdDev) and direction of the item from its mean (U):
Z-score = (x - U) / StDev
A value of zero indicates that the data item x is equal to the mean U, while positive or negative values show that the data item is above or below the mean (x Values of +2 and -2 show that the data item is two standard deviations above or below the chosen mean, respectively, and over 95.5% of all data items are contained within these two horizontal references). We substitute x with volume contango C, the mean U with simple moving average ( SMA ) of n periods (50), and StdDev with the standard deviation of closing contango for n periods (50), so the above formula becomes: Z-score = (C - SMA (50)) / StdDev(C,50).
When in contango, Bitcoin may be overbought.
When in backwardation, Bitcoin may be oversold.
The current bar calculation will always look incorrect due to TV plotting the Z-score before the bar closes.
Closing RangeIndicator shows the closing range of each bar. Closing range is where the bar closes (high - close) relative to the length of the wick (high - low). A close at the top of the wick would be 100%, middle 50%, bottom 0%.
In addition, the indicator multiplies closing range by volume to weight toward high volume days.
A simple moving average is applied to visualize trend in volume-weighted closing range over time.
Options include changing the threshold of bullish closes. The default is 50%, but you can view a close above 40% as a bullish.
Simple moving average can be enabled/disabled as well as the length adjusted.
Vervoort SmoothingThis script has both the Triple Exponential Moving Average (TEMA) and zero lag sma written as functions. Both from Capturing Profit with Technical Analysis (24-25) by Sylvain Vervoort.
Best regards,
capam
multi MA by Liquidator15 MA in a single indicator script.
7 different MA types:
- SMMA
- EMA
- SMA
- MG
- TMA
- DCF
- LSMA
multi timeframe.
Simple Moving Average CrossThe script uses 3 simple moving averages that you can define (SMA Top, SMA Mid, SMA Long).
Once the SMA Top is above the SMA Mid and the SMA Mid is above the SMA Top a long position is entered.
Once the SMA Top is below the SMA Mid and the SMA Mid is below the SMA Top a short position is entered.
You may define how long before these positions are entered by adjusting the bars in the Inputs section.
A setting of 0 will enter a position as soon as the conditions are met,
whereas a setting of 5 will wait 5 bars after the conditions are met before entering the positions.
SMA StrategyIn this strategy, I took advantage of two different sma intersections for buying and selling points. You can use the intersection of 2 sma values for buying and 2 separate sma intersection for selling.
The main purpose of this strategy is to calculate the rate of return of the indicator belonging to this system. You can access the indicator version from this link and set an alarm.
SMA Strategy - Indicator Version for AlertIn this indicator, I made use of two different sma intersections for buying and selling points. You can use the intersection of 2 sma values for buying and 2 separate sma intersection for selling.
There are 3 different alarms for those who want to set an alarm.
- Cross Alarm: The alarm that will work on buy-sell signals for those who have the right to set a single alarm.
- Buy Alarm: The alarm that will operate at the receiving point according to the values you specified.
- Sell Alarm: The alarm that will operate at the sales point according to the values you specify.
PineScript v4 - Forex Pin-Bar Trading StrategyPineScript v4, forex trading robot based on the commonly used bullish / bearish pin-bar piercing the moving averages strategy.
I coded this robot to stress-test the PineScript v4 language to see how advanced it is, and whether I could port a forex trading strategy from MT4 to TradingView.
In my opinion, PineScript v4 is still not a professional coding language; for example you cannot use IF-statements to modify the contents of global variables; this makes complex robot behaviour difficult to implement. In addition, it is unclear if the programmer can use nested IF-ELSE, or nested FOR within IF.
The sequence of program execution is also unclear, and although complex order entry and exit appears to function properly, I am not completely comfortable with it.
Recommended Chart Settings:
Asset Class: Forex
Time Frame: H1
Long Entry Conditions:
a) Moving Average up trend, fast crosses above slow
b) Presence of a Bullish Pin Bar
c) Pin Bar pierces either Moving Average
d) Moving Averages must be sloping up, angle threshold (optional)
Short Entry Conditions:
a) Moving Average down trend, fast crosses below slow
b) Presence of a Bearish Pin Bar
c) Pin Bar pierces either Moving Average
d) Moving Averages must be sloping down, angle threshold (optional)
Exit Conditions:
a) Stoploss level is hit
b) Takeprofit level is hit
c) Moving Averages cross-back (optional)
Default Robot Settings:
Equity Risk (%): 3 //how much account balance to risk per trade
Stop Loss (x*ATR, Float): 2.1 //stoploss = x * ATR, you can change x
Risk : Reward (1 : x*SL, Float): 3.1 //takeprofit = x * stop_loss_distance, you can change x
Fast MA (Period): 20 //fast moving average period
Slow MA (Period): 50 //slow moving average period
ATR (Period): 14 //average true range period
Use MA Slope (Boolean): true //toggle the requirement of the moving average slope
Bull Slope Angle (Deg): 1 //angle above which, moving average is considered to be sloping up
Bear Slope Angle (Deg): -1 //angle below which, moving average is considered to be sloping down
Exit When MA Re-Cross (Boolean): true //toggle, close trade if moving average crosses back
Cancel Entry After X Bars (Period): 3 //cancel the order after x bars not triggered, you can change x
Backtest Results (2019 to 2020, H1, Default Settings):
EURJPY - 111% profit, 2.631 profit factor, 16.43% drawdown
EURUSD - 103% profit, 2.899 profit factor, 14.95% drawdown
EURAUD - 76.75% profit, 1.8 profit factor, 17.99% drawdown
NZDUSD - 64.62% profit, 1.727 profit factor, 19.14% drawdown
GBPUSD - 58.73% profit, 1.663 profit factor, 15.44% downdown
AUDJPY - 48.71% profit, 1.635 profit factor, 11.81% drawdown
USDCHF - 30.72% profit, 1.36 profit factor, 22.63% drawdown
AUDUSD - 8.54% profit, 1.092 profit factor, 19.86% drawdown
EURGBP - 0.03% profit, 1.0 profit factor, 29.66% drawdown
USDJPY - 1.96% loss, 0.972 profit factor, 28.37% drawdown
USDCAD - 6.36% loss, 0.891 profit factor, 21.14% drawdown
GBPJPY - 28.27% loss, 0.461 profit factor, 39.13% drawdown
To reduce the possibility of curve-fitting, this robot was backtested on 12 popular forex currencies, as shown above. The robot was profitable on 8 out of 12 currencies, breakeven on 1, and made a loss on 3.
The default robot settings could be over-fitting for the EUR, as we can see out-sized performance for the EUR pairs, with the exception of the EURGBP. We can see that GBPJPY made the largest loss, so these two pairs could be related.
Risk Warning:
This is a forex trading strategy that involves high risk of equity loss, and backtest performance will not equal future results. You agree to use this script at your own risk.
Static + Dynamic LevelsShows static and dynamic levels which can act as support/resistance. These are important as there is a lot of users who are interested in buying/selling at these prices.
Static Levels include -
Daily/Weekly/Monthly/Yearly Open (changes color depending on if below or above price)
Previous Daily/Weekly/Monthly/Yearly Open
Previous day's High/Low
Dynamic Levels include -
100/200 Daily MA
100/200 Weekly MA
PEC Range (Prefer on 1D chart)Price Expansion and Contraction is basic calculation of Candles High-Low and it is average of previous 5 High-Low. Which will help to analyse volatility of running situation. This can be used for analysis purpose only not as buy/sell signals.
How to use this?
Ranges of candles may increase on lower value of PEC.
Ranges of candles may decrease on high of PEC.
This is not ATR of 5 period.
Barcolor Averaging1. Colors candles or bars, ascending (blue) or descending (red), as determined by the MA setting.
2. Colors candles white when the MA is flat, or the market is moving sideways or in consolidation.
Moving Average Colored EMA/3 SMA1. Updated this available script to have 2 SMA's and 2 EMA's.
2. Revised so that plot turns white when flat.
3. Added Trend Gain to control what slope "flat" has for different TF's.
The Lazy Trader - Index (ETF) Trend Following Robot50/150 moving average, index (ETF) trend following robot. Coded for people who cannot psychologically handle dollar-cost-averaging through bear markets and extreme drawdowns (although DCA can produce better results eventually), this robot helps you to avoid bear markets. Be a fair-weathered friend of Mr Market, and only take up his offer when the sun is shining! Designed for the lazy trader who really doesn't care...
Recommended Chart Settings:
Asset Class: ETF
Time Frame: Daily
Necessary ETF Macro Conditions:
a) Country must have healthy demographics, good ratio of young > old
b) Country population must be increasing
c) Country must be experiencing price-inflation
Default Robot Settings:
Slow Moving Average: 50 (integer) //adjust to suit your underlying index
Fast Moving Average: 150 (integer) //adjust to suit your underlying index
Bullish Slope Angle: 5 (degrees) //up angle of moving averages
Bearish Slope Angle: -5 (degrees) //down angle of moving averages
Average True Range: 14 (integer) //input for slope-angle formula
Risk: 100 (%) //100% risk means using all equity per trade
ETF Test Results (Default Settings):
SPY (1993 to 2020, 27 years), 332% profit, 20 trades, 6.4 profit factor, 7% drawdown
EWG (1996 to 2020, 24 years), 310% profit, 18 trades, 3.7 profit factor, 10% drawdown
EWH (1996 to 2020, 24 years), 4% loss, 26 trades, 0.9 profit factor, 36% drawdown
QQQ (1999 to 2020, 21 years), 232% profit, 17 trades, 3.6 profit factor, 2% drawdown
EEM (2003 to 2020, 17 years), 73% profit, 17 trades, 1.1 profit factor, 3% drawdown
GXC (2007 to 2020, 13 years), 18% profit, 14 trades, 1.3 profit factor, 26% drawdown
BKF (2009 to 2020, 11 years), 11% profit, 13 trades, 1.2 profit factor, 33% drawdown
A longer time in the markets is better, with the exception of EWH. 6 out of 7 tested ETFs were profitable, feel free to test on your favourite ETF (default settings) and comment below.
Risk Warning:
Not tested on commodities nor other financial products like currencies (code will not work), feel free to leave comments below.
Moving Average Slope Angle Formula:
Reproduced and modified from source:
SSL Backtester With ATR SL TP and Money ManagementSimilar to other SSL Channel scripts, but this one allows you to set an ATR-derived stop loss and adds the option to risk a % of the equity or used a fixed lot.
Enters upon a long or short SSL crossover.
FIXED LOTS
For 0.01 "lots" use 1000
For 1 standard lot, use 100,000
FOR MONEY MANAGEMENT
For 1% risk, enter 0.01
For 10% risk, enter 0.1
etc
You should be able to adapt this to any other indicator by just changing the entry conditions and adding your own indicator values.
It is not meant to be a profitable script, just a template to begin adding money management ideas to existing scripts which currently just enter and exit on an event.
Golden Ratio MultiplierThe moving averages 350 and 111 by themselves do a great job of identifying market tops/bottoms. The fraction 350/111 is very close to Pi as well (3.15) so that's is suspicious in its own right.
Nonetheless, fibonacci retracements/multiplies of the 350 SMA does a remarkable job of finding reversal points. I commented out a couple of multiplies for simplicity's sake (the lines became rather crowded). However, the script is open source so you all can copy it into Pine Editor and delete the "//" and add it back to the script.
Cheers.
AK Simple Moving Average 50 days Simple Moving average suitable for Intraday on 1Hr,30Min.15Min Time frames
1. When candle crossing above SMA Line - Go for Long Entries
2. When candle crossing below SMA Line - Go for short Entries