Better OBVOBV with William C. Garrett's Approximation
In the classical OBV (On-Balance Volume) indicator, it simply takes the idea from traditional tape reading - treat the "up tick" as Buy, "down tick" as Sell, and it assumes no change in price as neutral* (*which is not the case in tape reading).
When it comes to interpret the daily volume as such, errors will add up cumulatively. For example, there are days when a Doji Star with high volume just merely one cent higher than yesterday price and the whole day volume would be taken as a BUY Volume....
Here is a gentlemen, William C. Garrett, attempted to break down the daily volume into two parts in his book - "Torque Analysis of Stock Market Cycle".
Published indicator has two modes: Cumulative and Time Segmented. Time Segmented Volume (TSV) - performs a MACD operation on the Garrett Money Flow.
Note on Divergence:
When using a indicator as Time Segmented Money Flow, divergence would surely occur on and off. This is where Wyckoff 3rd principle comes into play - "Effort vs Result" that is not matching. Meaning that the cumulation of shares goes in one direction while the price goes another direction.
K-macd
MACD Seasons by Dr Ken Longthis specific Moving Average Divergence Convergence Seasons Indicator is made by Dr Ken Long Tortoise Capital brings a unique way of the flow of the market, the 4 seasons are used to describe the areas of the MACD so for example when the area is below zero and hasn't crossed the EMA 5 we call that winter which is very bear bias, once you get support in winter and crosses above the EMA 5 we call that fall which is the first indication of support for price and some weakness toward the downside. if the MACD is above the zero line we call that summer which is a very bull bias valued area, and once it crosses below the EMA 5 then that's where we call fall mode showing us weakness and very slight indication of a possible reversal. the MACD can be both used for swing trade and day trading, it provides a unique insight to the markets showing the layers of a trend using seasons.
MACD with Lines - ChartWhat is MACD with Lines - Chart and why do you need it?
I use it for chart analysis to identify key macd /signal levels from which bullish / bearish market structure continues to develop.
Chart means that every Macd /Signal cross above/below the signal lines will be notified on your Chart and not on your MACD Indicator. To see them on your chart please choose "MACD with Lines - Default" in my library.
Once Signal, Macd or the Histogramm cross over or under your upper or lower signal line you will see background colors which you can adjust in the settings menu.
This small indicator is for a larger project which will be uploaded in several days/weeks.
MACD with Lines - DefaultWhat is MACD with Lines - Default and why do you need it?
I use it for chart analysis to identify key macd/signal levels from which bullish/bearish market structure continues to develop.
Default means that every Macd/Signal cross above/below the signal lines will be notified on your MACD Indicator and not on your chart. To see them on your chart please choose "MACD with Lines - Chart" in my library.
Once Signal,Macd or the Histogramm cross over or under your upper or lower signal line you will see background colors which you can adjust in the settings menu.
This small indicator is for a larger project which will be uploaded in several days/weeks.
Combo Backtest 123 Reversal & MACD Crossover with Trail and Stop
This is a modification of @HPotter "Combo Backtest 123 Reversal & MACD Crossover" script.
I've added a trail stop, basic leverage simulation and stop loss.
Below is HPotter's explanation of the script principals.
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
MACD – Moving Average Convergence Divergence. The MACD is calculated
by subtracting a 26-day moving average of a security's price from a
12-day moving average of its price. The result is an indicator that
oscillates above and below zero. When the MACD is above zero, it means
the 12-day moving average is higher than the 26-day moving average.
This is bullish as it shows that current expectations (i.e., the 12-day
moving average) are more bullish than previous expectations (i.e., the
26-day average). This implies a bullish , or upward, shift in the supply/demand
lines. When the MACD falls below zero, it means that the 12-day moving average
is less than the 26-day moving average, implying a bearish shift in the
supply/demand lines.
A 9-day moving average of the MACD (not of the security's price) is usually
plotted on top of the MACD indicator. This line is referred to as the "signal"
line. The signal line anticipates the convergence of the two moving averages
(i.e., the movement of the MACD toward the zero line).
Let's consider the rational behind this technique. The MACD is the difference
between two moving averages of price. When the shorter-term moving average rises
above the longer-term moving average (i.e., the MACD rises above zero), it means
that investor expectations are becoming more bullish (i.e., there has been an
upward shift in the supply/demand lines). By plotting a 9-day moving average of
the MACD , we can see the changing of expectations (i.e., the shifting of the
supply/demand lines) as they occur.
WARNING:
- For purpose educate only
- This script to change bars colors.
MACD classic strategy setupsetup for a classic MACD strategy with some filter to choose.
it keep the default setup of MACD because is the most popular.
it place the stop loss and take profit based on the trading rush video of MACD, if you want a different profict factor you can change until to reach 3, over this as a fixed risk reward don't have so much sense
MACD Crossover Strategy with EMA200 Trend DetectionSimple MACD Strategy Indicator.
Rules:
- MACD Crossover with Signal Line
If
- MACD Crossover above zero line
- Price is below EMA200
=> Sell
If
- MACD Crossover below zero line (buy)
- Price is above EMA200
=> Buy
CT Reverse MACD CrossIntroducing the Reverse MACD Cross
MACD.... short for moving average convergence/divergence, is a trading indicator used in technical analysis of stock prices, created by Gerald Appel in the late 1970s.
It is designed to reveal changes in the strength, direction, momentum, and duration of a trend in a stock's price.
Prior work by Johny Dough showed how we can compute the price level required to make the MACD stay at its current level,
and also how to compute the price level required for the MACD to cross the zero line.
I have brought that idea to it logical conclusion for the MACD by creating a new function which also computes the price level required to cross the MACD with its signal line.
This allows the user to quickly see all of the most relevant information from the MACD and the actual price levels where the indicator will change its posture.
The MACD indicator (or "oscillator") is a collection of three time series calculated from historical price data, most often the closing price.
These three series are:
the MACD series proper shown here in blue
the "Signal Line" or "average" series shown here in red
the "Divergence" series which is the difference between the two shown here as a histogram.
There is also usually a baseline set at zero.
The MACD series is the difference between a "fast" (short period) exponential moving average (EMA), and a "slow" (longer period) EMA of the price series.
The average series (signal line) is an EMA of the MACD series itself.
The MACD indicator thus depends on three parameters, namely the time periods of the three EMAs.
The notation "MACD ( a, b, c )" usually denotes the standard indicator where the MACD series is the difference of EMAs with characteristic times a and b, and the average series is an EMA of the MACD series with characteristic time c.
There is an infobox which displays...
Whether the MACD is falling or rising
the price level which will make the MACD to change from rising to falling or vice versa
the price level which will cause the MACD to cross the signal line
the price level which will cause the MACD to cross the zero line
The most commonly used values are 12 for the fast, 26 for the slow, and 9 for the signal line, that is, MACD ( 12, 26, 9 ) .
The MACD and average series are customarily displayed as continuous lines in a plot whose horizontal axis is time oscillating above and below a zero line, whereas the divergence is commonly shown as a bar graph / histogram.
A fast EMA responds more quickly than a slow EMA to recent changes in a stock's price.
By comparing EMAs of different periods, the MACD series can indicate changes in the trend of a stock.
It is claimed that the divergence series can reveal subtle shifts in the stock's trend.
Since the MACD is based on moving averages, it is a lagging indicator. As a future metric of price trends, the MACD is less useful for stocks that are not trending (trading in a range) or are trading with unpredictable price action.
Pure Volume Divergence [NeoButane]PVD: MACD with volume as source.
Options to configure:
OBV, PVT, or MFI as source
Display PVD or a faux zero-based oscillating CVD
rocketLaunchI wanted to see if I could programmatically identify the conditions I saw just before Bitcoin broke its all-time high end of 2020. The signal picks up several rocket launch moments prior to launching which is quite cool. It also picks up a few false starts, however. In any case, I would have loved to be stopped out on those false starts but been there for all the starts this thing picks up.
It could probably use more confirmatory elements such as trailing conditions and volume perhaps?
BINANCE:BTCUSDTPERP
RedK_xMACD: Extending the classic MACD with a simple filterThis is a simple concept that attempts to squeeze more price action insights from the classic MACD
we add a 3rd (longer length, slower) Moving Average line that acts as a trend filter - so whenever we are ("we" = the price and the 2 other MAs) are above that filter line, we consider ourselves to be in the up-trend territory, and vica versa .. so the MACD calculation here - that is represented by the main (reg/green) line in the plot - will represent the distance between the slow MA and the filter MA - when that MACD line crosses the zero axis up or down, that represents the trand reversing from one direction to the other.
A signal line (a smoothed version of that MACD line) is still added for 2 reasons
1 - the signal line makes it easy to see if an eminent trend reversal is to be expected
2 - to stay visually-consistent with the classic MACD :)
the distance (or delta) between the other 2 MAs continues to reflect an indication of the short-term momentum and is what the histogram represents.
we still have the benefit of the convergence/diversion between the price itself and the histogram similar to the classic MACD
this MACD version will also clearly show how price and momentum action will lead the trend -- i know that's a big discussion topic :)
i added a classic MACD at the bottom panel, and used the same length settings (fast / slow) for side-by-side comparison
i coded this when i found that i use 3 moving averages all the time during my chart analysis, and while i'm a big fan of the classic MACD, i wanted to find a simple way to get my MACD to reflect what the 3 MAs on the price chart show. turned out to be insightful - i hope other fellow traders may find this useful
the code is simple and i started it from the built-in MACD in TradingView. Other annotations are added to the chart here as i believe this will better explain how the eXtended MACD works
- there are 4 reversals that occur in that chart, and i chose to show one in step-by-step fashion.
if more explanation is needed to how this can be used, pls let me know in the comments.
Myx.Mir_ MACD.V2 ][ c/w Hist.Color & LabelMoving average convergence divergence ( MACD ) is commonly and widely used for Technical Analysis .
// Basis- based on default setting
macdLine, signalLine, histLine = default setting
with additional "cosmetic/ Makeup"
1) for 4R1G set up Trader. Histogram color as follows:-
a) if Hist => 0 = Hist > Hist ? color.green : na, Hist < Hist ? color.red : na
b) if Hist <= 0 = Hist < Hist ? color.green : na, Hist > Hist ? color.red : na
2) crossover MACD Line, SignalLine- with label "EN" / "EX"
Do not follow the signal blindly. Trader's should be able to identify the trend whether there is uptrend, sideways and downtrend.
Entry and/or Exit are based on Trader's risk appetite.
[fareid] Quick Backtest Framework█ OVERVIEW
This Framework allows Pine Coders to quickly code Study() based signal/strategy and validate its viability before proceed to code with more advance/complex customized rules for entry, exit, trailstop, risk management etc..
This is somewhat an upgraded version of my earlier personal template with different strategy used, cleaner code
and additional features.
█ USE CASES
- You have an idea for trade signal and need a quick way to verify its potential before writing lengthy/complicated code
- You found a study script for trading signal in public library and want to validate it profitability with minimum effort before including it in your trading playbook
█ FEATURES
- Alert: Ready to use alert function based on signals from your custom indicator.
- Visual Backtest: Auto-plot entry, stop-loss and take profit for simple strategy performance analysis
- Backtest Statistic: Provide basic key metrics based on backtest strategy
- BTE External Signal Protocol: Ready to use code that will supply required state to PineCoders Backtesting & Trading Engine if you wish to have more advance and sophisticated backtesting engine
Notes: All of the above features have On/Off toggle
█ Description & How To Use
This Framework consist of 5 Modules but you only need to edit the first 2 Modules:
Module1: Indicator
Module2: Framework Input Protocol
Module3: Alert
Module4: Backtest
Module5: Backtest & Trading Engine
Tips: The source-code includes collapsible block by module for easy navigating
Module1: Indicator:
-----------------------------------------------------------------------------------
Main Module. Place custom indicator input parameter/calculation/indicator plotting here
Sample Strategy: Double MACD Crossover
MACD Signal: 1st MACD Cross above signal line indicate Buy Signal
1st MACD Cross below signal line indicate Sell Signal
MACD Filter: 2nd MACD is above 0 line indicate Uptrend
2nd MACD is below 0 line indicate Downtrend
Module2: Framework Input Protocol:
-----------------------------------------------------------------------------------
Use this module to connect main indicator/signal calculated in Module1 to the rest of the framework's module
4 variables needed to be defined here:
1. Uptrend
2. Dntrend
3. BuySignal
4. SellSignal
i'm not sure how to place a code snippet here to show you example so in the source code i already put a comment in Module2 on which part u need to edit. I hope its pretty simple to use.
Module3: Alert Module Description:
-----------------------------------------------------------------------------------
As long as the variables in Module2 properly defined, the alert module is ready to use without any further modification.
Input:
Enable Alert --> Enable TV's alert and plot signal to chart
Alert Type --> Set to take Buy only, Sell only or Both alert
Module4: Backtest Module Description:
-----------------------------------------------------------------------------------
As long as the variables in Module2 properly defined, the backtest module is ready to use without any further modification.
Input:
Backtest Stat --> Enable Backtest Statistic Label
Backtest Visual --> Enable Backtest visual simulation
Backtest Type --> Set to take Buy only or Sell only or both
SL Type -->
ATR : Set SL in ATR times Multiplier below entry price
Fixed : Set SL in fixed point below entry point (in 'Dollar'). e.g. for Stocks -> 0.5 equals to 50cent while for EURUSD currency -> 0.005 equal to 50 pips
HiLo Bar: Set SL at highest/lowest wick of previous bar plus/minus Fixed point. e.g. EURUSD HiLo=3 and Fixed Point = 0.0005, buy trade will place SL 5 Pips below lowest of previous 3 bar
SL ATR Multi --> Set Lookback Period used for SL's ATR calculation
SL ATR Multi --> Set ATR Multiplier for SL
SL Fixed --> Set Fixed Level for SL
SL Bar --> Set Number of previous bar to check for SL placement
TP RR Ratio --> Set TP based on RR multiplier. e.g. 2 means TP level will be twice further from entry point compared to Entry-SL distance.
Notes: The point is for preliminary testing, so it only supports 1 trade at a time and no Trailing Stop
Module5: Backtest & Trading Engine Description:
-----------------------------------------------------------------------------------
As long as the variables in Module2 properly defined, the Pinecoders BTE module is ready to use without any further modification.
Input:
External Signal Protocol --> Set ESP State to send to "Backtesting & Trading Engine "
Signal With Filter --> Use this to send entry signal that already filtered by this study indicator (without stoploss level)
Signal Without Filter --> Use this to send raw entry signal that are NOT YET FILTERED by this study indicator (without stoploss level)
Signal and Stop With Filter --> Use this to send entry signal WITH StopLoss that already filtered by this study indicator (with stoploss level)
Signal and Stop Without Filter --> Use this to send raw entry signal WITH StopLoss that are NOT YET FILTERED by this study indicator (with stoploss level)
Notes: Backtesting & Trading Engine already have built-in Filter, Entries and Stop Level. e.g. Unselect all their filter state if only want to use custom filter and make sure send Signal with Filter (with or without SL level)
█ DISCLAIMER:
This framework main objective is to create my personal indicator template so that i just have to modify the indicator module for preliminary testing in future.
The sample strategy included are for educational purpose only. Use at your own risk
credit: LucF/PineCoders for a lot of his scripts that i use as a guide to complete this
MACD With Trend Filter: Visual Backtest Module TemplateSample Strategy: MACD Crossover with trend filter options
MA Filter : Price Close Above MA, Search for Buy, Price Close Below MA, Search for Sell
ADX Filter : Take trade only when ADX is above certain treshold
MACD Signal : MACD Cross above signal line while under 0 line indicate Buy Signal
MACD Cross below signal line while above 0 line indicate Sell Signal
-----------------------------
Using Alert Module:
Enable Alert --> Enable TV's alert and plot signal to chart
Alert Type --> Set to take Buy only, Sell only or Both alert
----------------------------
Using Backtest Module:
Enable Backtest --> Enable Backtest simulation
Backtest Type --> Set to take Buy only, Sell only or Both
SL Type -->
ATR : Set SL in ATR times Multiplier below/above entry price
Fixed : Set SL in fixed point below entry point (in 'Dollar'). e.g. for Stocks -> 0.5 equals to 50cent while for EURUSD currency -> 0.005 equal to 50 pips
HiLo Bar : Set SL at highest/lowest wick of previous bar plus/minus Fixed point. e.g. EURUSD HiLo=3 and Fixed Point = 0.0005, buy trade will place SL 5 Pips below lowest of previous 3 bar
SL ATR Period --> Set Lookback Period used for SL's ATR calculation
SL ATR Multi --> Set ATR Multiplier for SL
SL Fixed --> Set Fixed Level for SL (Use when SL Type is either Fixed or HiLo Bar)
SL Bar --> Set Number of previous bar to check for SL placement
TP RR Ratio --> Set TP based on RR multiplier. e.g. 2 means TP level will be twice further from entry point compared to Entry-SL distance.
Notes: The point is for preliminary testing, so it only supports 1 trade at a time and no Trailing Stop
----------------------------
Disclaimer:
This script main objective is to create my personal indicator template so that i just have to modify the indicator module for preliminary testing in future.
Testing Alert Module so i can re-use it as template in future study/indicator
Testing Visual Backtest Module so i can re-use it as template in future study/indicator
i believe using Strategy function is a better approach for this but the entry/exit level seems to be hit n miss (at least for me, still trying to figure what i did wrong)
also, i rather code the strategy in other platform where i can use the more accurate tick data if i want to validate backtest statistics.
My study scripts was built only to test/visualize an idea to see its viability and if it can be used to optimize existing strategy.
credit: ADX code are originally from "ADX and DI" by @BeikabuOyaji although i re-wrote so i can have cleaner read and use RMA instead of SMA
RVSI & MACD Confluence BackgroundThis indicator colors the background in vertical (green/red) stripes to indicate if the current trend is possibly bull / bear
A region where the background is not colored indicates that the present trend can not be identified
The algo combines the RVSI (Relative Volume Strength Index {ref fract} ) and the MACD
The Relative Volume Strength Index has been adapted to include 2 moving averages, one fast and one slow
This same fast slow lookback length is applied to the MACD for simplicity
What's interesting is that there is a very strong confluence between the MACD and RVSI, as the MACD is obtained from 'price action only' and the RVSI from the 'volume only'
So a break in confluence of these two might suggest that the current trend is weakening in confidence or can not be clearly identified
Generally, a green background means consider going long ie price trend is rising
A red background means consider going short ie price trend is falling
An absent background color means - consider exiting current trade or wait to get into a new trade
Best Regards, MoonFlag - and a special thanks/mention to 'fract' for the RVSI algo this is derived from
MACD 50x Leveraged Short Strategy with Real Equity
Hello there ,
Short version of the Macd Long strategy.
MACD Long strategy:
Adding margin: Forbidden or not specified. (Add Margin : No)
Position size: (for each trade) 1%
Stop-Loss: (2% Above Entry Level)
Long: macd crossunder
Exit: macd crossover
Or ofc touching the stop-Loss value as predicted.
These strategies are just examples.
The goal is to observe true equity and equity change.
Warning: This strategy simulation is for Short direction only.
Regards.
MACD 50x Leveraged Long Strategy Results with Real Equity Hello there.
I was looking for a way to simulate leveraged transactions in Tradingview and this script came out.
You can examine the equity graph without looking at the strategy results.
Thus, the facts will come to light.
Strategy parameters:
Adding margin: Forbidden or not specified. (Add Margin : No)
Position size: (for each trade) 1%
Stop-Loss: (2%)
Long: macd crossover
Exit: macd crossunder
Or ofc touching the stop-Loss value as predicted.
Warning: This strategy simulation is for Long direction only.
Regards.
SALEH MACD Donchian + EMA & MACD + ADXI gathered all the signals coming from the MACD & Donchian channels indicators and filtered them with EMA 200 or ADX > 25 indicators (which both of them show the trend),
and put them on the chart to show me the buy and sell signals;
the signals rules are as following:
BUY:
when we have an uptrend ( the price is above the EMA 200 or ADX > 25 ) & the macd line cross up the signal line while they are both under the 0 level of histogram it generates buy signals.
SELL:
when we have a downtrend ( the price is below the EMA 200 or ADX > 25) & the macd line cross below the signal line while they are both above the 0 level of histogram it generates sell signals.
Donchian channel works as a confirmation for the macd signal.
this signals work best at London session, you can also filter them by chandelier exit indicator.
macd strategyOkay
User Avatar
Rules using ( MACD 12 26 Close 9 ):
Place a SELL signal when :
1. Histogram bar turned RED from GREEN
2. Within the previous group of green histogram bars the maximum value reached/passed +5.5
3. MACD fast & slow have values > 0
Place a BUY signal when :
1. Histogram bar turned GREEN from RED
2. Within the previous group of RED histogram bars has maximum value reached/passed -5.0
3. MACD fast & slow have values < 0
[RS]MACD Divergence V1This oscilator was created by Ricardo Santos using MACD's histogram as the series to find low and high fractals and from there find and plot divergences.
I just modified it a little bit to make it to look more like the MACD public library indicator and use the actual MACD series (instead of the histogram) to find the fractals and from there plot divergences.
I did this to make it easier for me and other fellow students of a Forex school where we use these type of divergences to find patterns.
MACD BeepBoop Indicator
The indicator flags long or blue when the macd histogram value > 0 and above the ema and short or red when the macd histogram value < 0 and below the ema
I have added confirmations in the form of eliminating all bars on the histogram unless they meet the long / short entry conditions two bars in a row
You can customize the length of the ema that determines the long/short entry conditions in the settings
I have also added a yellow highlight to the bar in the chart that you would enter on. You would enter at the open of the bar following the signal bar
Stop Loss would be placed at the nearest pivot point or ATR of your choice
Note - republishing this after taking out original links