Схождение/расхождение скользящих средних (MACD)
Combing in MACD and MTFHi all, I'm trying to wedge in the MACD into a multiple timeframe. Scope is to create:
1) an alert when the MACD across all timeframes is positive,
2) an alert when the MACD across all timeframes is negative, and
3) one when neither of them is applicable.
Would anyone be so kind to give it some thoughts, please?
//@version=2
strategy(" Easy MTF Strategy", overlay=false)
TF_1_time = input("3", "Timeframe 1")
TF_2_time = input("5", "Timeframe 2")
TF_3_time = input("15", "Timeframe 3")
TF_4_time = input("30", "Timeframe 4")
fastLen = input(title="Fast Length", type=integer, defval=12)
slowLen = input(title="Slow Length", type=integer, defval=26)
sigLen = input(title="Signal Length", type=integer, defval=9)
= macd(close, fastLen, slowLen, sigLen)
width = 5
upcolor = green
downcolor = red
neutralcolor = blue
linestyle = line
TF_1 = security(tickerid, TF_1_time, open) < security(tickerid, TF_1_time, close) ? true:false
TF_1_color = TF_1 ? upcolor:downcolor
TF_2 = security(tickerid, TF_2_time, open) < security(tickerid, TF_2_time, close) ? true:false
TF_2_color = TF_2 ? upcolor:downcolor
TF_3 = security(tickerid, TF_3_time, open) < security(tickerid, TF_3_time, close) ? true:false
TF_3_color = TF_3 ? upcolor:downcolor
TF_4 = security(tickerid, TF_4_time, open) < security(tickerid, TF_4_time, close) ? true:false
TF_4_color = TF_4 ? upcolor:downcolor
TF_global = TF_1 and TF_2 and TF_3 and TF_4
TF_global_bear = TF_1 == false and TF_2 == false and TF_3 == false and TF_4 == false
TF_global_color = TF_global ? green : TF_global_bear ? red : white
TF_trigger_width = TF_global ? 6 : width
plot(1, style=linestyle, linewidth=width, color=TF_1_color)
plot(5, style=linestyle, linewidth=width, color=TF_2_color)
plot(10, style=linestyle, linewidth=width, color=TF_3_color)
plot(15, style=linestyle, linewidth=width, color=TF_4_color)
plot(25, style=linestyle, linewidth=4, color=TF_global_color)
exitCondition_Long = TF_global_bear
exitCondition_Short = TF_global
longCondition = TF_global
if (longCondition)
strategy.entry("MTF_Long", strategy.long)
shortCondition = TF_global_bear
if (shortCondition)
strategy.entry("MTF_Short", strategy.short)
strategy.close("MTF_Long", when=exitCondition_Long)
strategy.close("MTF_Short", when=exitCondition_Short)
Basic BIASBasic BIAS
Deviation rate (bias), also known as deviation rate, or y-value for short, is an indicator to reflect the deviation degree between the price and MA in a certain period of time by calculating the percentage difference between the market index or closing price and a moving average, so as to obtain the possibility that the price will reverse or rebound due to deviation from moving average trend in case of severe fluctuation, and that the price will move within the normal fluctuation range Form the credibility of continuing the original potential.
The deviation rate is a percentage of the deviation degree (gap rate) between the price and ma.
The departure rate curve (bias) is a curve that connects the values of each bias into a line and obtains a wave extension curve with the value of 0 as the horizontal axis.
MacD 200 Day Moving Average Signal Crossover StrategyThis works on most time frames, but I noticed the 4 hour for BTCUSD on coinbase seems to work well as an example. The strategy is pretty simple. I was inspired by a youtube video that said to backtest their strategy so I did. Most of the time it doesn't work but sometimes it's pretty good as in the case I showed.
Basically, you buy if the MacD crossers over the signal line and the histogram is below 0 and you are above the 200 day moving average. Do the opposite to sell!
Fear And Greed IndicatorThe Fear And Greed Indicator is a very popular indicator on the Bloomberg platform and since I didn't have actual source code to work with, this is a very close approximation of that indicator. Let me know if you spot any discrepancies with the original and I will do my best to fix them.
For buy and sell signals it is pretty straightforward. Just buy when the green (greed) is in control and sell when the fear (red) is in control
This was a special request so let me know if you want to see more scripts from me or if you want something custom!
MACD with divergence signalsIts an MACD indicator which highlights places where macd and signal line cross and hidden divergence ocures.
Logic behind it is to check if we have hidden divergence when crossing of that two lines and if above EMA200 (signal for BUY - green) or if below EMA200 (signal for SELL - red).
You can change lenght of EMA but i think 200 is a simpliest trend indicator.
CDC ActionZone V3 2020## CDC ActionZone V3 2020 ##
This is an update to my earlier script, CDC ActionZone V2
The two scripts works slightly differently with V3 reacting slightly faster.
The main update is focused around conforming the standard to Pine Script V4.
## How it works ##
ActionZone is a very simple system, utilizing just two exponential moving
averages. The 'Zones' in which different 'actions' should be taken is
highlighted with different colors on the chart. Calculations for the zones
are based on the relative position of price to the two EMA lines and the
relationship between the two EMAs
CDCActionZone is your barebones basic, tried and true, trend following system
that is very simple to follow and has also proven to be relatively safe.
## How to use ##
The basic method for using ActionZone is to follow the green/red color.
Buy when bar closes in green.
Sell when bar closes in red.
There is a small label to help with reading the buy and sell signal.
Using it this way is safe but slow and is expected to have around 35-40%
accuracy, while yielding around 2-3 profit factors. The system works best
on larger time frames.
The more advanced method uses the zones to switch between different
trading system and biases, or in conjunction with other indicators.
example 1:
Buy when blue and Bullish Divergence between price and RSI is visible,
if not Buy on Green and vise-versa
example 2:
Set up a long-biased grid and trade long only when actionzone is in
green, yellow or orange.
change the bias to short when actionzone turns to te bearish side
(red, blue, aqua)
(Look at colors on a larger time frame)
## Note ##
The price field is set to close by default. change to either HL2 or OHLC4
when using the system in intraday timeframes or on market that does not close
(ie. Cryptocurrencies)
## Note2 ##
The fixed timeframe mode is for looking at the current signal on a larger time frame
ie. When looking at charts on 1h you can turn on fixed time frame on 1D to see the
current 'zone' on the daily chart plotted on to the hourly chart.
This is useful if you wanted to use the system's 'Zones' in conjunction with other
types of signals like Stochastic RSI, for example.
MACD crossover while RSI Oversold/OverboughtThis indicator draws signals on the chart when a Bullish MACD Crossover occurs at the same time RSI is "oversold", and also when Bearish MACD Crossover occurs at the same time RSI is "overbought"
Indicators are drawn on the chart in the following scenarios:
1. Bullish signal
a. MACD bullish crossover occurs on a single bar
b. RSI was below the Oversold threshold (29 by default) within the prior 5 bars
2. Bearish signal
a. MACD bearish crossover occurs on a singnle bar
b. RSI was above the Overbought threshold (71 by default) within the prior 5 bars
AverageTrueRangeConvergenceDivergenceV1sloth288Simple indicator with the thought of merging MACD and ATR. The idea has come from trying to find a way to define sideways markets. Whipped this up quickly to explore the idea.
Feel free to throw in suggestions or even mention other open source indicators that define sideways markets well.
Simple instructions
If histogram green, breakouts/trade zone.
If histogram red, sideways/keep out.
Trend Checker by Hally - IndicatorIt is an indicator that overlaps MACD and Stochastics.
It has both characteristics.
The trend changes when two lines intersect.
I think the reaction is bad in the range market.
Also, when there are Stochastics and MACD lines above the indicator, it is possible to think whether it is overbought while riding the trend, and it may be helpful for making decisions such as "maybe it will reverse soon". Hmm.
Also, I think it is better to use it in combination with other indicators.
This is my first pine script, and I couldn't find it even if I searched for the script with overlapping indicators of different scales, so I tried making it by trial and error.
I hope it helps somebody trying to do the same.
MACDとStochasticsを重ね合わせたインジケーターです。
それぞれの特徴を併せ持っています。
2本のラインが交差する時トレンドが変化します。
レンジ相場では反応が悪いと思います。
また、インジケーターの上の位置にStochasticsとMACDラインがあるときはトレンドに乗りながらも買われすぎかどうか考えられることが出来ますし、「そろそろ反転するかも」などの判断の助けになるかもしれません。
また、他の指標との併用して使うほうが良いと思います。
pineスクリプトは初めてで、異なるスケールのインジケーターを重ね合わせていスクリプトは探しても見つからなかったので試行錯誤で作ってみました。
同じようなことをやろうとしてる誰かの参考になれば幸いです。
Simple Mobile Averages y MACDScript designed for users who need more than 3 indicators. It has 3 programmable "Simple Mobile Averages". MACD integrated in the main panel, also programmable.
MACRS {Lite}This is the open-source stripped down version of the full-featured RSI-MACD indicator (MACRS), with the ADO and the option to filter out weekend price action removed.
The main oscillator is the RSI modulated by the MACD (default). The RSI mode can be disabled to revert to a normal MACD oscillator for the main oscillator.
When the main oscillator (thicker line) is > 0, it is green; and if it is < 0, it is red.
The MACD can be re-scaled and whenever its value > 100, a background fill between the oscillator and the zeroline appear to indicates overbought condition; and < -100 indicates oversold condition. The user can tweak the scaling factor to optimize this for a given chart and timeframe.
A (thick transparent light blue) volume oscillator is also provided. An increase in volume trend provides confirmation of (or solidifies) the movements in the main oscillator over that period. A falling volume oscillator trend raises doubts on the main oscillator trend, and hints of the possibility of a counter-trend (also look at the secondary ADO oscillator for clues).
The novel aspects and principles of this indicator and this source code are the property of © cybernetwork.
This indicator and script is free for the TV community to use.
ANTS BEAST MODE TRIX+MACD TRIX CROSSThis indicator is both the TRIX + MACD all in one inidicator -- a + sign is displayed whenever the trix crosses
MACD/ATRThis indicator is a restricted MACD .
I reached this with a little trick: I devided it by ATR . This way it is most of the time inside the -1..1 range. It depends on the length of the ATR's period. If it is greater, the probability of outliers is greater.
With this indicator you can use cerain levels of MACD and its histogram as a trigger.
Share with me if you found it useful.
StarbuxI made this in starbucks .
Bullish hammer trading signal algorithm
using MACD for trend determination and holding period.
DEMA Strategy with MACDThe Double Exponential Moving Average (DEMA) indicator was introduced in January 1994 by Patrick G. Mulloy, in an article in the "Technical Analysis of Stocks & Commodities" magazine: "Smoothing Data with Faster Moving Averages"
It attempts to remove the inherent lag associated to Moving Averages by placing more weight on recent values. The name suggests this is achieved by applying a double exponential smoothing which is not the case. The name double comes from the fact that the value of an EMA (Exponential Moving Average) is doubled. To keep it in line with the actual data and to remove the lag the value "EMA of EMA" is subtracted from the previously doubled ema.
DEMA is a very responsive system. A lot of signals can be generated only when trading with DEMA. In this strategy, I combined Dema buy-sell signals with MACD indicator. When you activate MACD confirmation from settings; When DEMA comes to long situation, the MACD histogram is checked to be positive.
Trend Trader Strategy with MACDThis is plots the indicator developed by Andrew Abraham in the Trading the Trend article of TASC September 1998
The strategy I use has already been published explicitly by HPotter, you can review the core code from there.
I have converted the existing strategy codes that have been published into the strategy and the result looks great but I noticed that the indicator performed too much in short periods like 1 minute and I thought it would be healthier to get MACD approval. MACD approval will come selected by default. When the indicator reaches the buy status, if the macd histogram is positive, it enters the long process. By removing this confirmation from the settings window, you can see the normal signal frequency of the indicator.
This strategy is mainly based on trend signals. In fact, I am publishing this strategy to use in alternating trading for Bear-Bull crypto coins.
What does the bear-bull comparison mean?
You can open the same chart in the ETHBEAR / USDT symbol as opposed to the ETHBULL / USDT symbol that appears on the chart. When BUY signal comes in bull symbol, SELL will come in bear symbol. When BUY signal comes in bear symbol, SELL will come in bull symbol. In this way, very fast and very high profit can be obtained by alternating operation.
MACD At Scales with AlertsI use the horizontal scale lines on the MACD indicator as part of my scalping strategy along with other indicators like RSI/EMA and Market Cipher B when trading BTC
I am looking for a cross above or below the 12.5 and 25 horizontal scale lines, along with lining up other indicators
I set my alerts on the 5 min TF and look to the 15 and 30 min TF's for further confirmation.
I have find the scale lines to be very useful for visual reference of the crosses, above/below 25 lines is mostly a safer trade, crosses above/below 12.5 lines can have more risk, crosses between 0 baseline and 12.5 can have a higher return but have much more risk.
Don't ever use just this indicator by itself, you must always have at least 2 indicators running
This is an example of the TF's not lining up, so a entry here would be high risk
This is an example of the TF's lining up, so a entry here would be less risk
WMA + MACD strategy with trailing stopHi!
That's my first strategy. I already learn pine, so i will work on it more. Now i search how to make trailing stop working.
"WMA + MACD strategy with traiing stop" is very simple strategy which is designated for stocks market. It is created only to take long positions.
Buy signal is when WMA(120) is below price and macd(10,20,10) histogram is higher than 0.
Position should be automaticly closed when price hits stoploss level.
One transaction should be max 20% of our capital and stoploss is set 3% lower than last closing price.
Quadratic Weighted (QWMA) MACDMACD but on the Quadratic Weighted Moving Average instead of regular Moving Average
"The quadratic moving average ( QMA ) or quadratic weighted moving average (QWMA) is a type of moving average who is closer to the price when price is up trending. This moving average is defined as the square root of the moving average of the squared price." @alexgrover ()
Base MACD code from @RicardoSantos ()
Ultimate Momentum IndicatorThis is an indicator I've been playing with for a while, based on my previous MACD w/ RSI Warning indicator. This one takes it a step further, including information from MACD, RSI, ADX, and Parabolic SAR. These four indicators are represented in this indicator as follows:
MACD: The histogram itself is a normal MACD histogram. Nothing strange about it, and you can adjust the settings for it just as you would a normal MACD.
RSI: Any time the RSI is outside of normal ranges (which can be adjusted in the settings), the bar on the histogram will turn amber to warn you. The actual RSI value is also shown in a label to the left side of the indicator.
ADX: Crosses are drawn along the 0 line to indicate ADX. Blue means the ADX is below the trending level (adjustable in the settings), and orange means it is above that level. Darker colors indicate the ADX has gone up since the previous bar, while lighter colors indicate it has gone down. The actual ADX value is also shown in the label to the left side of the indicator.
Parabolic SAR: At the outside point of each bar in the histogram, a colored dot is drawn. If the dot is green, the Parabolic SAR (settings adjustable) is currently below the closing price. If the dot is red, the SAR is above the closing price.
I must stress that this indicator is not a replacement for any one of the indicators it includes, as it's really only pulling small bits of information from each. The point of this indicator is to give a cohesive picture of momentum at a quick glance. I encourage you to continue to use the normal versions of whichever of the basic indicators you already use, especially if those indicators are a key part of your strategy. This indicator is designed purely as a way to get a bird's eye view of the momentum.
Pretty much every normally adjustable value can be adjusted in the settings for each of the base indicators. You can also set:
The RSI warning levels (30 and 70 by default)
The ADX Crossover, i.e. the point at which you consider the ADX value to indicate a strong trend (25 by default)
The offset for the label which shows the actual RSI & ADX values (109 by default, which happens to line up with my chart layout--yours will almost certainly need to be different to look clean)
All of the colors, naturally
As always, I am open to suggestions on how I might make the indicator look cleaner, or even other indicators I might try to include in the data this indicator produces. My choice of indicators to base this one from is entirely based on the ones I use and know, but I'm sure there are other great indicators that may improve this combination indicator even more!
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