Market Structure Trailing Stop [LuxAlgo]This script returns trailing stops on the occurrence of market structure (CHoCH/BOS labeling). Trailing stops are adjusted based on trailing maximums/minimums with the option for users to be able to control how quickly a trailing stop can converge toward the price.
🔶 SETTINGS
Pivot Lookback: Pivot length used for the detection of swing points.
Increment Factor %: Controls how fast trailing stops converge toward the price, with lower values returning slower converging trailing stops.
Reset Stop On: Determines if trailing stops are reset on CHoCH structure or all (CHoCH + BOS).
Show Structure: Determines if market structure is displayed.
🔶 USAGE
Trailing stops allow traders to protect them against downside risk while also guaranteeing a potential profit in case the market goes in the expected direction of the trade.
Users making use of market structure as a primary entry condition can benefit from having trailing stops based on these to either provide an additional exit condition or to provide points of support/resistance with the price.
Trailing stops can avoid being hit more frequently by using a lower Increment Factor % setting.
Finally, users can reset the trailing stop when any market structure is detected (or only on CHoCHs). Allowing trailing stops to reset on the detection of any market structure allows the indicator to return trailing stops closer to the price. CHoCH labels are highlighted as dashed lines while BOS labels are highlighted as dotted lines.
🔶 DETAILS
When a new structure (or only CHoCH if specified by the user) is detected, trailing stops will initially be set based on the maximum/minimum made on the previous trend. This will also set the trailing maximum/minimum to the current price value.
If an uptrend is detected (most recent market structure is bullish) then the trailing stop will increase if the trailing maximum increase, the increment is calculated as:
trailing stop = trailing stop + Increment Factor % of (trailing maximum - previous trailing maximum)
If a downtrend is detected (most recent market structure is bearish) then the trailing stop will decrease if the trailing minimum decrease, the decrement is calculated as:
trailing stop = trailing stop + Increment Factor % of (trailing minimum - previous trailing minimum)
Marketstructure
ICT Concepts [LuxAlgo]The ICT Concepts indicator regroups core concepts highlighted by trader and educator "The Inner Circle Trader" (ICT) into an all-in-one toolkit. Features include Market Structure (MSS & BOS), Order Blocks, Imbalances, Buyside/Sellside Liquidity, Displacements, ICT Killzones, and New Week/Day Opening Gaps.
🔶 SETTINGS
🔹 Mode
When Present is selected, only data of the latest 500 bars are used/visualized, except for NWOG/NDOG
🔹 Market Structure
Enable/disable Market Structure.
Length: will set the lookback period/sensitivity.
In Present Mode only the latest Market Structure trend will be shown, while in Historical Mode, previous trends will be shown as well:
You can toggle MSS/BOS separately and change the colors:
🔹 Displacement
Enable/disable Displacement.
🔹 Volume Imbalance
Enable/disable Volume Imbalance.
# Visible VI's: sets the amount of visible Volume Imbalances (max 100), color setting is placed at the side.
🔹 Order Blocks
Enable/disable Order Blocks.
Swing Lookback: Lookback period used for the detection of the swing points used to create order blocks.
Show Last Bullish OB: Number of the most recent bullish order/breaker blocks to display on the chart.
Show Last Bearish OB: Number of the most recent bearish order/breaker blocks to display on the chart.
Color settings.
Show Historical Polarity Changes: Allows users to see labels indicating where a swing high/low previously occurred within a breaker block.
Use Candle Body: Allows users to use candle bodies as order block areas instead of the full candle range.
Change in Order Blocks style:
🔹 Liquidity
Enable/disable Liquidity.
Margin: sets the sensitivity, 2 points are fairly equal when:
'point 1' < 'point 2' + (10 bar Average True Range / (10 / margin)) and
'point 1' > 'point 2' - (10 bar Average True Range / (10 / margin))
# Visible Liq. boxes: sets the amount of visible Liquidity boxes (max 50), this amount is for Sellside and Buyside boxes separately.
Colour settings.
Change in Liquidity style:
🔹 Fair Value Gaps
Enable/disable FVG's.
Balance Price Range: this is the overlap of latest bullish and bearish Fair Value Gaps.
By disabling Balance Price Range only FVGs will be shown.
Options: Choose whether you wish to see FVG or Implied Fair Value Gaps (this will impact Balance Price Range as well)
# Visible FVG's: sets the amount of visible FVG's (max 20, in the same direction).
Color settings.
Change in FVG style:
🔹 NWOG/NDOG
Enable/disable NWOG; color settings; amount of NWOG shown (max 50).
Enable/disable NDOG ; color settings; amount of NDOG shown (max 50).
🔹 Fibonacci
This tool connects the 2 most recent bullish/bearish (if applicable) features of your choice, provided they are enabled.
3 examples (FVG, BPR, OB):
Extend lines -> Enabled (example OB):
🔹 Killzones
Enable/disable all or the ones you need.
Time settings are coded in the corresponding time zones.
🔶 USAGE
By default, the indicator displays each feature relevant to the most recent price variations in order to avoid clutter on the chart & to provide a very similar experience to how a user would contruct ICT Concepts by hand.
Users can use the historical mode in the settings to see historical market structure/imbalances. The ICT Concepts indicator has various use cases, below we outline many examples of how a trader could find usage of the features together.
In the above image we can see price took out Sellside liquidity, filled two bearish FVGs, a market structure shift, which then led to a clean retest of a bullish FVG as a clean setup to target the order block above.
Price then fills the OB which creates a breaker level as seen in yellow.
Broken OBs can be useful for a trader using the ICT Concepts indicator as it marks a level where orders have now been filled, indicating a solidified level that has proved itself as an area of liquidity. In the image above we can see a trade setup using a broken bearish OB as a potential entry level.
We can see the New Week Opening Gap (NWOG) above was an optimal level to target considering price may tend to fill / react off of these levels according to ICT.
In the next image above, we have another example of various use cases where the ICT Concepts indicator hypothetically allow traders to find key levels & find optimal entry points using market structure.
In the image above we can see a bearish Market Structure Shift (MSS) is confirmed, indicating a potential trade setup for targeting the Balanced Price Range imbalance (BPR) below with a stop loss above the buyside liquidity.
Although what we are demonstrating here is a hindsight example, it shows the potential usage this toolkit gives you for creating trading plans based on ICT Concepts.
Same chart but playing out the history further we can see directly after price came down to the Sellside liquidity & swept below it...
Then by enabling IFVGs in the settings, we can see the IFVG retests alongside the Sellside & Buyside liquidity acting in confluence.
Which allows us to see a great bullish structure in the market with various key levels for potential entries.
Here we can see a potential bullish setup as price has taken out a previous Sellside liquidity zone and is now retesting a NWOG + Volume Imbalance.
Users also have the option to display Fibonacci retracements based on market structure, order blocks, and imbalance areas, which can help place limit/stop orders more effectively as well as finding optimal points of interest beyond what the primary ICT Concepts features can generate for a trader.
In the above image we can see the Fibonacci extension was selected to be based on the NWOG giving us some upside levels above the buyside liquidity.
🔶 DETAILS
Each feature within the ICT Concepts indicator is described in the sub sections below.
🔹 Market Structure
Market structure labels are constructed from price breaking a prior swing point. This allows a user to determine the current market trend based on the price action.
There are two types of Market Structure labels included:
Market Structure Shift (MSS)
Break Of Structure (BOS)
A MSS occurs when price breaks a swing low in an uptrend or a swing high in a downtrend, highlighting a potential reversal. This is often labeled as "CHoCH", but ICT specifies it as MSS.
On the other hand, BOS labels occur when price breaks a swing high in an uptrend or a swing low in a downtrend. The occurrence of these particular swing points is caused by retracements (inducements) that highlights liquidity hunting in lower timeframes.
🔹 Order Blocks
More significant market participants (institutions) with the ability of placing large orders in the market will generally place a sequence of individual trades spread out in time. This is referred as executing what is called a "meta-order".
Order blocks highlight the area where potential meta-orders are executed. Bullish order blocks are located near local bottoms in an uptrend while bearish order blocks are located near local tops in a downtrend.
When price mitigates (breaks out) an order block, a breaker block is confirmed. We can eventually expect price to trade back to this breaker block offering a new trade opportunity.
🔹 Buyside & Sellside Liquidity
Buyside / Sellside liquidity levels highlight price levels where market participants might place limit/stop orders.
Buyside liquidity levels will regroup the stoploss orders of short traders as well as limit orders of long traders, while Sellside liquidity levels will regroup the stoploss orders of long traders as well as limit orders of short traders.
These levels can play different roles. More informed market participants might view these levels as source of liquidity, and once liquidity over a specific level is reduced it will be found in another area.
🔹 Imbalances
Imbalances highlight disparities between the bid/ask, these can also be defined as inefficiencies, which would suggest that not all available information is reflected by the price and would as such provide potential trading opportunities.
It is common for price to "rebalance" and seek to come back to a previous imbalance area.
ICT highlights multiple imbalance formations:
Fair Value Gaps: A three candle formation where the candle shadows adjacent to the central candle do not overlap, this highlights a gap area.
Implied Fair Value Gaps: Unlike the fair value gap the implied fair value gap has candle shadows adjacent to the central candle overlapping. The gap area is constructed from the average between the respective shadow and the nearest extremity of their candle body.
Balanced Price Range: Balanced price ranges occur when a fair value gap overlaps a previous fair value gap, with the overlapping area resulting in the imbalance area.
Volume Imbalance: Volume imbalances highlight gaps between the opening price and closing price with existing trading activity (the low/high overlap the previous high/low).
Opening Gap: Unlike volume imbalances opening gaps highlight areas with no trading activity. The low/high does not reach previous high/low, highlighting a "void" area.
🔹 Displacement
Displacements are scenarios where price forms successive candles of the same sentiment (bullish/bearish) with large bodies and short shadows.
These can more technically be identified by positive auto correlation (a close to open change is more likely to be followed by a change of the same sign) as well as volatility clustering (large changes are followed by large changes).
Displacements can be the cause for the formation of imbalances as well as market structure, these can be caused by the full execution of a meta order.
🔹 Kill Zones
Killzones represent different time intervals that aims at offering optimal trade entries. Killzones include:
- New York Killzone (7:9 ET)
- London Open Killzone (2:5 ET)
- London Close Killzone (10:12 ET)
- Asian Killzone (20:00 ET)
🔶 Conclusion & Supplementary Material
This script aims to emulate how a trader would draw each of the covered features on their chart in the most precise representation to how it's actually taught by ICT directly.
There are many parallels between ICT Concepts and Smart Money Concepts that we released in 2022 which has a more general & simpler usage:
ICT Concepts, however, is more specifically aligned toward the community's interpretation of how to analyze price 'based on ICT', rather than displaying features to have a more classic interpretation for a technical analyst.
Simple Market StructureThis indicator is meant for education and experimental purposes only.
Many Market Structure Script out there isn't open-sourced and some could be complicated to understand to modify the code. Hence, I published this code to make life easier for beginner programmer like me to modify the code to fit their custom indicator.
As I am not a expert or pro in coding it might not be as accurate as other reputable author.
Any experts or pros that is willing to contribute this code in the comment section below would be appreciated, I will modify and update the script accordingly as part of my learning journey.
It is useful to a certain extend to detect Market Structure using Swing High/Low in all market condition.
Here are some points that I am looking to improve / fix:
To fix certain horizontal lines that does not paint up to the point where it breaks through.
To add in labels when a market structure is broken.
Allow alerts to be sent when market structure is broken (Probably be done in the last few updates after knowing it is stable and as accurate as possible)
Any suggested improvement, please do let me know in the comment section below and I will try my best to implement it into the script.
Faytterro Market Structerethis indicator creates the market structure with a little delay but perfectly. each zigzag is always drawn from highest to lowest. It also signals when the market structure is broken. signals fade over time.
The table above shows the percentage distance of the price from the last high and the last low.
zigzags are painted green when making higher peaks, while lower peaks are considered downtrends and are painted red. In fact, the indicator is quite simple to understand and use.
"length" is used to change the frequency of the signal.
"go to past" is used to see historical data.
Please review the examples:
Swing Levels and Liquidity - By LeviathanThis script will plot pivot points (swing highs and lows) in the form of lines, boxes or labels to help you identify market structure, “liquidity” areas, swing failure patterns, etc. You are also able to see the volume traded at each pivot point, which will help you compare their significance.
Bars Left-Right
A pivot high (swing high) is a bar in a series of bars that has a higher value than the bars around it and a pivot low (swing low) is a bar in a series of bars that has a lower value than the bars surrounding it. The Bars Left and Bars Right parameters are used to define the number of bars on the left and right sides of a pivot point that the function should consider when identifying pivot highs and lows in a time series. For example, if Bars Left is set to 5 and Bars Right is set to 6, the function will look for a pivot point by comparing the value of the current bar with the values of the 5 bars to its left and the 6 bars to its right. If the value of the current bar is higher than all of these bars, it is considered a pivot high point. These parameter can be used to adjust the sensitivity of the script (lowering the Bars Left and Bars Right parameters will give you more swing points and increasing the Bars Left and Bars Right parameters will give you fewer swing points).
”Show Boxes” - This will draw a box above the swing high and a box below the swing low to help you visualise a large area of interest around swing points. Additional box types and the width of the box can be adjusted in Appearance settings below.
”Show Lines” - This will draw a horizontal line at the level of each swing high and swing low.
”Show Labels” - This will plot a circle at the high point of each swing high and at the low point of each swing low.
”Show Volume” - This will display the amount of volume traded in a given swing point candle. It can help you identify the significance of a given swing point by comparing it to the volumes of other swing points.
”Extend Until Filled” - This will extend the swing point levels until they are mitigated by the price. Turning it off will continue plotting the levels just a few more bars after a swing point occurs.
”Appearance” - You can show/hide swing points, choose the colors of labels, lines and boxes, choose the size and positioning of the text, choose line and box appearance (adjust the Box Width when switching between timeframes!) and more.
More updates coming soon (MTF, more data…)
Market Structure MA Based BOS [liwei666]
🎲 Overview
🎯 This BOS(Break Of Structure) indicator build based on different MA such as EMA/RMA/HMA, it's usually earlier than pivothigh() method
when trend beginning, customer your BOS with 2 parameters now.
🎲 Indicator design logic
🎯 The logic is simple and code looks complex, I‘ll explain core logic but not code details.
1. use close-in EMA's highest/lowest value mark as SWING High/Low when EMA crossover/under,
not use func ta.pivothigh()/ta.pivotlow()
2. once price reaching EMA’s SWING High/Low, draw a line link High/Low to current bar, labled as BOS
3. find regular pattern benefit your trading.
🎲 Settings
🎯 there are 4 input properties in script, 2 properties are meaningful in 'GRP1' another 2 are display config in 'GRP2'.
GRP1
MA_Type: MA type you can choose(EMA/RMA/SMA/HMA), default is 'HMA'.
short_ma_len: MA length of your current timeframe on chart
GRP2
show_short_zz: Show short_ma Zigzag
show_ma_cross_signal: Show ma_cross_signal
🎲 Usage
🎯 BOS signal usually worked fine in high volatility market, low volatility is meaningless.
🎯 We can see that it performs well in trending market of different symbols, and BOS is an opportunity to add positions
BINANCE:BTCUSDTPERP
BINANCE:ETHUSDTPERP
🎯 MA Based signal is earlier than pivothigh()/pivotlow() method when trend beginning. it means higher profit-loss rate.
🎯 any questions or suggestion please comment below.
Additionally, I plan to publish 20 profitable strategies in 2023; indicatior not one of them,
let‘s witness it together!
Hope this indicator will be useful for you :)
enjoy! 🚀🚀🚀
MarketStructureLibrary "MarketStructure"
This library contains functions for identifying Lows and Highs in a rule-based way, and deriving useful information from them.
f_simpleLowHigh()
This function finds Local Lows and Highs, but NOT in order. A Local High is any candle that has its Low taken out on close by a subsequent candle (and vice-versa for Local Lows).
The Local High does NOT have to be the candle with the highest High out of recent candles. It does NOT have to be a Williams High. It is not necessarily a swing high or a reversal or anything else.
It doesn't have to be "the" high, so don't be confused.
By the rules, Local Lows and Highs must alternate. In this function they do not, so I'm calling them Simple Lows and Highs.
Simple Highs and Lows, by the above definition, can be useful for entries and stops. Because I intend to use them for stops, I want them all, not just the ones that alternate in strict order.
@param - there are no parameters. The function uses the chart OHLC.
@returns boolean values for whether this bar confirms a Simple Low/High, and ints for the bar_index of that Low/High.
f_localLowHigh()
This function finds Local Lows and Highs, in order. A Local High is any candle that has its Low taken out on close by a subsequent candle (and vice-versa for Local Lows).
The Local High does NOT have to be the candle with the highest High out of recent candles. It does NOT have to be a Williams High. It is not necessarily a swing high or a reversal or anything else.
By the rules, Local Lows and Highs must alternate, and in this function they do.
@param - there are no parameters. The function uses the chart OHLC.
@returns boolean values for whether this bar confirms a Local Low/High, and ints for the bar_index of that Low/High.
f_enhancedSimpleLowHigh()
This function finds Local Lows and Highs, but NOT in order. A Local High is any candle that has its Low taken out on close by a subsequent candle (and vice-versa for Local Lows).
The Local High does NOT have to be the candle with the highest High out of recent candles. It does NOT have to be a Williams High. It is not necessarily a swing high or a reversal or anything else.
By the rules, Local Lows and Highs must alternate. In this function they do not, so I'm calling them Simple Lows and Highs.
Simple Highs and Lows, by the above definition, can be useful for entries and stops. Because I intend to use them for trailing stops, I want them all, not just the ones that alternate in strict order.
The difference between this function and f_simpleLowHigh() is that it also tracks the lowest/highest recent level. This level can be useful for trailing stops.
In effect, these are like more "normal" highs and lows that you would pick by eye, but confirmed faster in many cases than by waiting for the low/high of that particular candle to be taken out on close,
because they are instead confirmed by ANY subsequent candle having its low/high exceeded. Hence, I call these Enhanced Simple Lows/Highs.
The levels are taken from the extreme highs/lows, but the bar indexes are given for the candles that were actually used to confirm the Low/High.
This is by design, because it might be misleading to label the extreme, since we didn't use that candle to confirm the Low/High..
@param - there are no parameters. The function uses the chart OHLC.
@returns - boolean values for whether this bar confirms an Enhanced Simple Low/High
ints for the bar_index of that Low/High
floats for the values of the recent high/low levels
floats for the trailing high/low levels (for debug/post-processing)
bools for market structure bias
f_trueLowHigh()
This function finds True Lows and Highs.
A True High is the candle with the highest recent high, which then has its low taken out on close by a subsequent candle (and vice-versa for True Lows).
The difference between this and an Enhanced High is that confirmation requires not just any Simple High, but confirmation of the very candle that has the highest high.
Because of this, confirmation is often later, and multiple Simple Highs and Lows can develop within ranges formed by a single big candle without any of them being confirmed. This is by design.
A True High looks like the intuitive "real high" when you look at the chart. True Lows and Highs must alternate.
@param - there are no parameters. The function uses the chart OHLC.
@returns - boolean values for whether this bar confirms an Enhanced Simple Low/High
ints for the bar_index of that Low/High
floats for the values of the recent high/low levels
floats for the trailing high/low levels (for debug/post-processing)
bools for market structure bias
Market Structure - By LeviathanThis indicator helps you identify market structure by plotting swing highs and lows (HH, LH, HL, LL), BOS/CHOCH and 0.5 retracement levels. Other functionalities will be added in future updates.
Indicator Settings Overview
SWING LENGTH
The number of leftbars and rightbars when searching for swing points. The lower the value, the more swing points are shown and the higher the value, the less swing points are shown. I suggest adjusting it to fit your style and when switching between different timeframes.
BOS CONFIRMATION
Choose whether a Break of Structure is determined by a candle close or a wick breaching previous swing point. Using the "Wick" confirmation option will result in more breaks of structure.
CHOCH
Turning this ON renames the first counter trend Break of Structure (BOS) to CHoCH (Change of Character) and therefore signaling a possible trend shift.
SHOW 0.5 RETRACEMENT LEVEL
This will show a level halfway between a swing low and a swing high of an expansion move, which can act as an approximate retracement point if the trend continues.
In uptrends, 0.5 level is drawn between Higher Lows (HL) and Higher Highs ( HHs ). Long entries can be placed around that level if you suspect that the uptrend will continue.
In downtrends, 0.5 level is drawn between Lower Highs (LH) and Lower Lows (LLs). Short entries can be placed around that level if you suspect that the downtrend will continue.
Traders Reality MainThis indicator serves as the Tradingview equivalent of an MT4 indicator suite.
It differentiates from existing TV indicators in its style and total feature set (most notably PVSRA and PVSRA Override)
It was originally designed for forex markets, and it will work for crypto as well, but it has not been tested on stocks.
List of features:
PVSRA Candles
Market boxes (NY/JP/ HK /UK/ FR and Brinks Boxes)
5/13/50/200/800 EMAs (cloud for 50EMA)
Pivot points (S/M/R 1,2,3; PP )
Yesterday and Last Week price range
Average Daily Range (Weekly and Monthly as well)
Daily Open
PVSRA Override
Psychological High/Low
Vector Candle Zones
All of these are configurable in the indicator settings.
Usage instructions:
PVSRA Candle colors meaning:
Green (bull) and red (bear): Candles with volume >= 200% of the average volume of the 10 previous chart candles, and candles where the product of candle spread x candle volume is >= the highest for the 10 previous chart time candles.
Blue (bull) and blue-violet (bear): Candles with volume >= 150% of the average volume of the 10 previous chart candles
PVSRA Override
In order to get reliable bar coloring, we need accurate data. If you're on a chart with low volume on some obscure exchange, you may want to use another exchanges datafeed for the symbol you are on to calculate the PVSRA bar colors with. This lets you do exactly that. By default it's off, but you can turn it on and use INDEX:BTCUSD, or really any other chart you want. You can combine charts too, e.g. use BINANCE:BTCUSDT+COINBASE:BTCUSD.
PVSRA Alerts
Alerts can be made for PVSRA "vector"/"climax" candles:
1. Create Alert (Clock with + sign)
2. Set Condition: "Traders Reality",
3. Select "Alert on Vector Candle",
4. Set it to Once per Bar,
5. choose your notification options.
Market boxes
The market boxes times are configurable and will change depending on the exchange timezone. I recommend to pick your main exchange/chart and adjust the times so that they are correct. Technically you will need to shift the time from the exchanges' timezone to GMT . Default values should be good for UTC based exchanges in current US+UK summer time.
Psychological High/Low
Configurable for Crypto or Forex - draws the perceived Psychological High/Low ranges for the week. Can display historical values too.
Vector Candle Zones
displays unrecovered liquidity left behind on unrecovered vectors. Configurable to take into account candle bodies or candles and wicks.
Recommended additional Tradingview indicator(s):
- TDI - Goldminds, Edited for Market Makers Method by Jakub Donovan
Footnotes
The code was originally by plasmapug, continued development (with permission) is now done by infernix and peshocore and xtech5192 in collaboration with TradersReality.
If you have suggestions or questions, you can message me or leave a comment.
Traders_Reality_LibLibrary "Traders_Reality_Lib"
This library contains common elements used in Traders Reality scripts
calcPvsra(pvsraVolume, pvsraHigh, pvsraLow, pvsraClose, pvsraOpen, redVectorColor, greenVectorColor, violetVectorColor, blueVectorColor, darkGreyCandleColor, lightGrayCandleColor)
calculate the pvsra candle color and return the color as well as an alert if a vector candle has apperared.
Situation "Climax"
Bars with volume >= 200% of the average volume of the 10 previous chart TFs, or bars
where the product of candle spread x candle volume is >= the highest for the 10 previous
chart time TFs.
Default Colors: Bull bars are green and bear bars are red.
Situation "Volume Rising Above Average"
Bars with volume >= 150% of the average volume of the 10 previous chart TFs.
Default Colors: Bull bars are blue and bear are violet.
Parameters:
pvsraVolume : the instrument volume series (obtained from request.sequrity)
pvsraHigh : the instrument high series (obtained from request.sequrity)
pvsraLow : the instrument low series (obtained from request.sequrity)
pvsraClose : the instrument close series (obtained from request.sequrity)
pvsraOpen : the instrument open series (obtained from request.sequrity)
redVectorColor : red vector candle color
greenVectorColor : green vector candle color
violetVectorColor : violet/pink vector candle color
blueVectorColor : blue vector candle color
darkGreyCandleColor : regular volume candle down candle color - not a vector
lightGrayCandleColor : regular volume candle up candle color - not a vector
@return
adr(length, barsBack)
Parameters:
length : how many elements of the series to calculate on
barsBack : starting possition for the length calculation - current bar or some other value eg last bar
@return adr the adr for the specified lenght
adrHigh(adr, fromDo)
Calculate the ADR high given an ADR
Parameters:
adr : the adr
fromDo : boolean flag, if false calculate traditional adr from high low of today, if true calcualte from exchange midnight
@return adrHigh the position of the adr high in price
adrLow(adr, fromDo)
Parameters:
adr : the adr
fromDo : boolean flag, if false calculate traditional adr from high low of today, if true calcualte from exchange midnight
@return adrLow the position of the adr low in price
splitSessionString(sessXTime)
given a session in the format 0000-0100:23456 split out the hours and minutes
Parameters:
sessXTime : the session time string usually in the format 0000-0100:23456
@return
calcSessionStartEnd(sessXTime, gmt)
calculate the start and end timestamps of the session
Parameters:
sessXTime : the session time string usually in the format 0000-0100:23456
gmt : the gmt offset string usually in the format GMT+1 or GMT+2 etc
@return
drawOpenRange(sessXTime, sessXcol, showOrX, gmt)
draw open range for a session
Parameters:
sessXTime : session string in the format 0000-0100:23456
sessXcol : the color to be used for the opening range box shading
showOrX : boolean flag to toggle displaying the opening range
gmt : the gmt offset string usually in the format GMT+1 or GMT+2 etc
@return void
drawSessionHiLo(sessXTime, show_rectangleX, show_labelX, sessXcolLabel, sessXLabel, gmt, sessionLineStyle)
Parameters:
sessXTime : session string in the format 0000-0100:23456
show_rectangleX : show the session high and low lines
show_labelX : show the session label
sessXcolLabel : the color to be used for the hi/low lines and label
sessXLabel : the session label text
gmt : the gmt offset string usually in the format GMT+1 or GMT+2 etc
sessionLineStyle : the line stile for the session high low lines
@return void
calcDst()
calculate market session dst on/off flags
@return indicating if DST is on or off for a particular region
timestampPreviousDayOfWeek(previousDayOfWeek, hourOfDay, gmtOffset, oneWeekMillis)
Timestamp any of the 6 previous days in the week (such as last Wednesday at 21 hours GMT)
Parameters:
previousDayOfWeek : Monday or Satruday
hourOfDay : the hour of the day when psy calc is to start
gmtOffset : the gmt offset string usually in the format GMT+1 or GMT+2 etc
oneWeekMillis : the amount if time for a week in milliseconds
@return the timestamp of the psy level calculation start time
getdayOpen()
get the daily open - basically exchange midnight
@return the daily open value which is float price
newBar(res)
new_bar: check if we're on a new bar within the session in a given resolution
Parameters:
res : the desired resolution
@return true/false is a new bar for the session has started
toPips(val)
to_pips Convert value to pips
Parameters:
val : the value to convert to pips
@return the value in pips
rLabel(ry, rtext, rstyle, rcolor, valid, labelXOffset)
a function that draws a right aligned lable for a series during the current bar
Parameters:
ry : series float the y coordinate of the lable
rtext : the text of the label
rstyle : the style for the lable
rcolor : the color for the label
valid : a boolean flag that allows for turning on or off a lable
labelXOffset : how much to offset the label from the current position
rLabelOffset(ry, rtext, rstyle, rcolor, valid, labelXOffset)
a function that draws a right aligned lable for a series during the current bar
Parameters:
ry : series float the y coordinate of the lable
rtext : the text of the label
rstyle : the style for the lable
rcolor : the color for the label
valid : a boolean flag that allows for turning on or off a lable
labelXOffset : how much to offset the label from the current position
rLabelLastBar(ry, rtext, rstyle, rcolor, valid, labelXOffset)
a function that draws a right aligned lable for a series only on the last bar
Parameters:
ry : series float the y coordinate of the lable
rtext : the text of the label
rstyle : the style for the lable
rcolor : the color for the label
valid : a boolean flag that allows for turning on or off a lable
labelXOffset : how much to offset the label from the current position
drawLine(xSeries, res, tag, xColor, xStyle, xWidth, xExtend, isLabelValid, labelXOffset, validTimeFrame)
a function that draws a line and a label for a series
Parameters:
xSeries : series float the y coordinate of the line/label
res : the desired resolution controlling when a new line will start
tag : the text for the lable
xColor : the color for the label
xStyle : the style for the line
xWidth : the width of the line
xExtend : extend the line
isLabelValid : a boolean flag that allows for turning on or off a label
labelXOffset : how much to offset the label from the current position
validTimeFrame : a boolean flag that allows for turning on or off a line drawn
drawLineDO(xSeries, res, tag, xColor, xStyle, xWidth, xExtend, isLabelValid, labelXOffset, validTimeFrame)
a function that draws a line and a label for the daily open series
Parameters:
xSeries : series float the y coordinate of the line/label
res : the desired resolution controlling when a new line will start
tag : the text for the lable
xColor : the color for the label
xStyle : the style for the line
xWidth : the width of the line
xExtend : extend the line
isLabelValid : a boolean flag that allows for turning on or off a label
labelXOffset : how much to offset the label from the current position
validTimeFrame : a boolean flag that allows for turning on or off a line drawn
drawPivot(pivotLevel, res, tag, pivotColor, pivotLabelColor, pivotStyle, pivotWidth, pivotExtend, isLabelValid, validTimeFrame, levelStart, pivotLabelXOffset)
draw a pivot line - the line starts one day into the past
Parameters:
pivotLevel : series of the pivot point
res : the desired resolution
tag : the text to appear
pivotColor : the color of the line
pivotLabelColor : the color of the label
pivotStyle : the line style
pivotWidth : the line width
pivotExtend : extend the line
isLabelValid : boolean param allows to turn label on and off
validTimeFrame : only draw the line and label at a valid timeframe
levelStart : basically when to start drawing the levels
pivotLabelXOffset : how much to offset the label from its current postion
@return the pivot line series
getPvsraFlagByColor(pvsraColor, redVectorColor, greenVectorColor, violetVectorColor, blueVectorColor, lightGrayCandleColor)
convert the pvsra color to an internal code
Parameters:
pvsraColor : the calculated pvsra color
redVectorColor : the user defined red vector color
greenVectorColor : the user defined green vector color
violetVectorColor : the user defined violet vector color
blueVectorColor : the user defined blue vector color
lightGrayCandleColor : the user defined regular up candle color
@return pvsra internal code
updateZones(pvsra, direction, boxArr, maxlevels, pvsraHigh, pvsraLow, pvsraOpen, pvsraClose, transperancy, zoneupdatetype, zonecolor, zonetype, borderwidth, coloroverride, redVectorColor, greenVectorColor, violetVectorColor, blueVectorColor, lightGrayCandleColor)
a function that draws the unrecovered vector candle zones
Parameters:
pvsra : internal code
direction : above or below the current pa
boxArr : the array containing the boxes that need to be updated
maxlevels : the maximum number of boxes to draw
pvsraHigh : the pvsra high value series
pvsraLow : the pvsra low value series
pvsraOpen : the pvsra open value series
pvsraClose : the pvsra close value series
transperancy : the transparencfy of the vecor candle zones
zoneupdatetype : the zone update type
zonecolor : the zone color if overriden
zonetype : the zone type
borderwidth : the width of the border
coloroverride : if the color overriden
redVectorColor : the user defined red vector color
greenVectorColor : the user defined green vector color
violetVectorColor : the user defined violet vector color
blueVectorColor : the user defined blue vector color
lightGrayCandleColor : the user defined regular up candle color
cleanarr(arr)
clean an array from na values
Parameters:
arr : the array to clean
@return if the array was cleaned
calcPsyLevels(oneWeekMillis, showPsylevels, psyType, sydDST)
calculate the psy levels
4 hour res based on how mt4 does it
mt4 code
int Li_4 = iBarShift(NULL, PERIOD_H4, iTime(NULL, PERIOD_W1, Li_0)) - 2 - Offset;
ObjectCreate("PsychHi", OBJ_TREND, 0, Time , iHigh(NULL, PERIOD_H4, iHighest(NULL, PERIOD_H4, MODE_HIGH, 2, Li_4)), iTime(NULL, PERIOD_W1, 0), iHigh(NULL, PERIOD_H4,
iHighest(NULL, PERIOD_H4, MODE_HIGH, 2, Li_4)));
so basically because the session is 8 hours and we are looking at a 4 hour resolution we only need to take the highest high an lowest low of 2 bars
we use the gmt offset to adjust the 0000-0800 session to Sydney open which is at 2100 during dst and at 2200 otherwize. (dst - spring foward, fall back)
keep in mind sydney is in the souther hemisphere so dst is oposite of when london and new york go into dst
Parameters:
oneWeekMillis : a constant value
showPsylevels : should psy levels be calculated
psyType : the type of Psylevels - crypto or forex
sydDST : is Sydney in DST
@return
Smart Money Concepts (SMC) [LuxAlgo]This all-in-one indicator displays real-time market structure (internal & swing BOS / CHoCH), order blocks, premium & discount zones, equal highs & lows, and much more...allowing traders to automatically mark up their charts with widely used price action methodologies. Following the release of our Fair Value Gap script, we received numerous requests from our community to release more features in the same category.
"Smart Money Concepts" (SMC) is a fairly new yet widely used term amongst price action traders looking to more accurately navigate liquidity & find more optimal points of interest in the market. Trying to determine where institutional market participants have orders placed (buy or sell side liquidity) can be a very reasonable approach to finding more practical entries & exits based on price action.
The indicator includes alerts for the presence of swing structures and many other relevant conditions.
Features
This indicator includes many features relevant to SMC, these are highlighted below:
Full internal & swing market structure labeling in real-time
Break of Structure (BOS)
Change of Character (CHoCH)
Order Blocks (bullish & bearish)
Equal Highs & Lows
Fair Value Gap Detection
Previous Highs & Lows
Premium & Discount Zones as a range
Options to style the indicator to more easily display these concepts
Settings
Mode: Allows the user to select Historical (default) or Present, which displays only recent data on the chart.
Style: Allows the user to select different styling for the entire indicator between Colored (default) and Monochrome.
Color Candles: Plots candles based on the internal & swing structures from within the indicator on the chart.
Internal Structure: Displays the internal structure labels & dashed lines to represent them. (BOS & CHoCH).
Confluence Filter: Filter non-significant internal structure breakouts.
Swing Structure: Displays the swing structure labels & solid lines on the chart (larger BOS & CHoCH labels).
Swing Points: Displays swing points labels on chart such as HH, HL, LH, LL.
Internal Order Blocks: Enables Internal Order Blocks & allows the user to select how many most recent Internal Order Blocks appear on the chart.
Swing Order Blocks: Enables Swing Order Blocks & allows the user to select how many most recent Swing Order Blocks appear on the chart.
Equal Highs & Lows: Displays EQH/EQL labels on chart for detecting equal highs & lows.
Bars Confirmation: Allows the user to select how many bars are needed to confirm an EQH/EQL symbol on chart.
Fair Value Gaps: Displays boxes to highlight imbalance areas on the chart.
Auto Threshold: Filter out non-significant fair value gaps.
Timeframe: Allows the user to select the timeframe for the Fair Value Gap detection.
Extend FVG: Allows the user to choose how many bars to extend the Fair Value Gap boxes on the chart.
Highs & Lows MTF: Allows the user to display previous highs & lows from daily, weekly, & monthly timeframes as significant levels.
Premium/Discount Zones: Allows the user to display Premium, Discount, and Equilibrium zones on the chart
Usage
Users can see automatic CHoCH and BOS labels to highlight breakouts of market structure, which allows to determine the market trend. In the chart below we can see the internal structure which displays more frequent labels within larger structures. We can also see equal highs & lows (EQH/EQL) labels plotted alongside the internal structure to frequently give indications of potential reversals.
In the chart below we can see the swing market structure labels. These are also labeled as BOS and CHoCH but with a solid line & larger text to show larger market structure breakouts & trend reversals. Users can be mindful of these larger structure labels while trading internal structures as displayed in the previous chart.
Order blocks highlight areas where institutional market participants open positions, one can use order blocks to determine confirmation entries or potential targets as we can expect there is a large amount of liquidity at these order blocks. In the chart below we can see 2 potential trade setups with confirmation entries. The path outlined in red would be a potential short entry targeting the blue order block below, and the path outlined in green would be a potential long entry, targeting the red order blocks above.
As we can see in the chart below, the bullish confirmation entry played out in this scenario with the green path outlined in hindsight. As price breaks though the order blocks above, the indicator will consider them mitigated causing them to disappear, and as per the logic of these order blocks they will always display 5 (by default) on the chart so we can now see more actionable levels.
The Smart Money Concepts indicator has many other features and here we can see how they can also help a user find potential levels for price action trading. In the screenshot below we can see a trade setup using the Previous Monthly High, Strong High, and a Swing Order Block as a stop loss. Accompanied by the Premium from the Discount/Premium zones feature being used as a potential entry. A potential take profit level for this trade setup that a user could easily identify would be the 50% mark labeled with the Fair Value Gap & the Equilibrium all displayed automatically by the indicator.
Conclusion
This indicator highlights all relevant components of Smart Money Concepts which can be a very useful interpretation of market structure, liquidity, & more simply put, price action. The term was coined & popularized primarily within the forex community & by ICT while making its way to become a part of many traders' analysis. These concepts, with or without this indicator do not guarantee a trader to be trading within the presence of institutional or "bank-level" liquidity, there is no supporting data regarding the validity of these teachings.
DOW 30 - Market BreadthDOW 30 indicator is intended for short-term intraday analysis and should not be used solely alone. Best to use this indicator in a combination with technical and fundamental analysis.
This indicator is calculated from all stocks in the DJI as of 8/9/2022;
- Evaluating VWAP,
- 9 EMA,
- 20 EMA.
Vwap Calculations;
Stock above Vwap = 1 (Vwap Bull),
Stock below Vwap = 1 (Vwap Bear),
As there are 30 stocks in the DJI, there is a max value of 30 Vwap Bulls/ Vwap Bears.
Ema Calculation;
Stock above 9 EMA = 0.5 (EMA Bulls),
Stock below 9 EMA = 0.5 (EMA Bears),
Stock above 20 EMA = 0.5 (EMA Bulls),
Stock below 20 EMA = 0.5 (EMA Bears),
For the EMA Bulls to reach 30 all stocks must be trading above both the 9 EMA and 20 EMA to reach a Max Value of 30.
The reasoning for this calculation is to suggest the current strength and speed of the current turn in the market.
Horizontal Lines:
There are three horizontal lines, MAX, MIN & Neutral;
MAX & MIN
Resides at the 30 & 0 levels suggesting the market is currently at an extreme. Representing all stocks are moving in the same direction together.
When the MAX or MIN are represented in the VWAP Line this represents directional conviction in the underlining DJI.
Neutral
Neutral resides at the 15 level and represents that the market is either about to make a decision or is choppy.
EXAMPLE
Below are some examples of how the DOW 30 indicator is able to represent the current market conditions.
Understand Current Market Conditions, either being Bullish, Neutral, or Bearish.
See live Market Mechanics, and understand the current market direction on a short-term timeframe.
DOW 30 indicator is intended for short-term intraday analysis and should not be used solely alone. Best to use this indicator in a combination with technical and fundamental analysis.
If there are any additional requests to the indicator feel free to leave a comment or privet message.
Best of luck trading.
Market Structure Patterns (Nephew_Sam_)This market structure indicator plots HH/LL labels with a little twist - it can identify upto 14 custom patterns of your choice!
Indicator settings:
Pivot strength - highest or lowest point in a number of x left+right bars
Show - show zigzag lines, HHLL labels, Pattern Matches
Patterns - upto 14 patterns (7 bear, 7 bull) with custom label text
Styles - for labels and lines
Disclaimer
- Although 90% of this indicator is custom coded, I have to give credits to LonesomeTheBlue (www.tradingview.com) for his "Double Zig Zag with HHLL" indicator where I got the logic on how to plot the labels in real time.
- This indicator repaints labels in realtime (not historical candle)
NASDAQ Advance/Decline Line 1.0NASDAQ Advance/Decline Line is a Market Breath indicator.
Brought to you by IQ-trading (Andrei Bogdan) via Trading View Pine script. If you find this helpful in anyway, please leave a like!
A/D line calculates a ratio between total number of NASDAQ stocks advancing and total number of NASDAQ stocks in one day, providing another way to grasp the market breath at any moment.A
Green columns mean more than 50% of NASDAQ stocks are advancing, red columns mean more than 50% of NASDAQ stocks are declining.
Green values above the top band mean correlation to the upside, red values bellow the low band mean correlation to the downside.
Correlation means rising probability of capitulation (to the upside or to the downside).
For a better interpretation, NASDAQ Advance/Decline Line should be used in conjunction with other indicators (volatility, volume, etc.).
--------------------
NASDAQ here refers to the totality of assets listed on the NASDAQ exchange, not to the Nasdaq Composite index or the Nasdaq100 index.
NASDAQ is the second-largest stock exchange on earth, and operates the two major stock indexes based on companies that trade on its exchange: the Nasdaq Composite and the Nasdaq 100.
The Nasdaq Composite tracks the performance of more than 3,000 stocks listed on the Nasdaq while the Nasdaq 100 captures the performance of the exchange’s largest non-financial companies.
Super OrderBlock / FVG / BoS Tools by makuchaku & eFeThis super indicator is a Swiss army knife for Smart Money traders for OrderBlocks / FVG / BoS
It provides many options for drawing (non-repainting) boxes for OrderBlocks, Fair Value Gaps (FVG) and Break of Structures. The boxes are extended into the future, until the first retest/mitigation.
Some of the additional options (not explained in the diagrams above)
PPDD OB : An order block which is formed after interacting with Liquidity (old low/high, fractal low/high, etc). Since these OB's are in the most premium or most discount, they are Premium Premium Discount Discount OB's (PPDD OB)
HVB Bars : When the volume of any bar is higher than the average volume of last N bars, it could mean something important (in the right context). Hence, the indicator allows for coloring them differently.
This indicator was built as a collaboration between @makuchaku & eFe
Pro tip : This indicator is a simply a tool to visualize trading concepts on the candle stick chart. It is the job of the trader to sequence these effectively into a profitable trade.
If you come across any bug or have a question on how to effectively use the indicator, please don't hesitate to ask questions.
Good luck & good trading!
Broken Fractal : Someone's broken dream is your profit!Idea
The idea is simple : when market turns around, it traps a bunch of traders off guard. We trade with them, in the same direction of their exit!
Method
We let the market first create a fractal
We then let the market create an opposite fractal
We then let the market break the first fractal it created, thereby trapping lots of trades in the process
We then patiently wait till the market gives these trapped traders a chance to exit - and we trade in the same direction
How to use?
Green boxes are for long entry, red boxes are for short.
Whenever a box appears, that's the risk criteria - setup limit orders and trade along!
Works on all timeframes
If you like this script, please leave a note on how you are using it.
I personally use it with Higher Timeframe bias.
PS1 : some traders call this Break of market structure, some call it Breaker, I just call it "Broken Fractal"
PS2 : Break of a broken fractal is also very potent. Watch out for those!
Multi-Indicator by johntradingwickThe Multi-Indicator includes the functionality of the following indicators:
1. Market Structure
2. Support and Resistance
3. VWAP
4. Simple Moving Average
5. Exponential Moving Average
Functionality of the Multi-Indicator:
Market Structure
As we already know, the market structure is one of the most important things in trading. If we are able to identify the trend correctly, it takes away a huge burden. For this, I have used the Zig Zag indicator to identify price trends. It plots points on the chart whenever the prices reverse by a larger percentage than a predetermined variable. The points are then connected by straight lines that will help you to identify the swing high and low.
This will help you to filter out any small price movements, making it easier to identify the trend, its direction, and its strength levels. You can change the period in consideration and the deviation by changing the deviation % and the depth.
Support and Resistance
The indicator provides the functionality to add support and resistance levels. If you want more levels just change the timeframe it looks at in the settings. It will pull the SR levels off the timeframe specified in the settings.
You can select the timeframe for support and resistance levels. The default time frame is “same as the chart”.
You can also extend lines to the right and change the width and colour of the lines. There is also an option to change the criteria to select the lines as valid support or resistance. You can extend the S/R level or use the horizontal lines to mark the level when there is a change in polarity.
VWAP
Volume Weighted Average Price (VWAP) is used to measure the average price weighted by volume. VWAP is typically used with intraday charts as a way to determine the general direction of intraday prices. It's similar to a moving average in that when the price is above VWAP, prices are rising and when the price is below VWAP, prices are falling. VWAP is primarily used by technical analysts to identify market trend.
Simple Moving Average
A simple Moving Average is an unweighted Moving Average. This means that each day in the data set has equal importance and is weighted equally. As each new day ends, the oldest data point is dropped and the newest one is added to the beginning.
The multi-indicator has the ability to provide 5 moving averages. This is particularly helpful if you want to use various time periods such as 20, 50, 100, and 200. Although this is just basic functionality, it comes in handy if you are using a free account.
Exponential Moving Average
An exponential moving average (EMA) is a type of moving average (MA) that places a greater weight and significance on the most recent data points. An exponentially weighted moving average reacts more significantly to recent price changes than a simple moving average. The multi-indicator provides 5 exponential moving averages. This is particularly helpful if you want to use various time periods such as 20, 50, 100, and 200.
Screener: Alpha & Beta IndexThis is a Index Screener which can short list the major Sectors contributing to NIFTY movement that day.
This helps in sector based trading, in which we can trade in the stocks which falls under that particular sector.
No need to roam around all the stocks in the whole watchlist.
It is recommended to create sector wise watchlist of all sectors. It will be easier to concentrate in only one sector.
For example in IT sector index there are certain stocks which contribute to the movement of IT sector.
This will be available in NSE (or exchange website).
For detailed description check out the descriptions in my previous 2 Alpha and Beta indicators.
Combine and use this screener with my previous Alpha & Beta indicator.
Market Structure (Nephew_Sam_)This indicator consists of 3 features:
1. Plots label to the right for current market structure
2. Plots dashed line to show where the next market structure would be
3. Draws arrows above/below historical market structure breaks
This might get a little to noisy in ranging markets or lower timeframes but it does the job.
Credits to @SimpleCryptoLife for the source code.
This script is take from the indicator "True Market Structure" which is created by the above mentioned user
Copyright rules for reusing the script:
// == COPYRIGHT ==
// Script by @SimpleCrpytoLife. This script is open-source.
// --> If you use ideas from it, you don't need to ask or give credit to me.
// --> If you copy code out of here to adapt for your own script, it must be open-source. You don't need to ask permission, just credit @SimpleCryptoLife.
[SCL] True Market StructureSee market structure at a glance with Higher Highs and Lower Lows. Bullish/Bearish/Ranging market bias is automatically derived. Optionally get alerted for breaks in market structure. Uses true Local Highs/Lows instead of simply the highest/lowest "pivot" for x bars. Can be useful as a support for learning market structure or for alerts for a change in structure while you're not at the computer.
Odin's Inside Bar IndicatorA simple indicator that identifies "inside bars" by painting them blue.
An inside candle is a candle that has a lower high and higher low than the previous candle.
I like to use it on the daily chart to find areas of price compression that lead to a breakout.
The price then often trends in the direction of the breakout.
Especially powerful when combined with other market structure analysis.
Cheers.
Dav-o meter (public)I decided to make this formerly invite only script public (you can find the invite only version here
If you are part of the invite only you don't need to change scripts. I will push improvements first on the invite only script but in time it will come to this version as well.
I would love to know your ideas and thoughts on how this indicator can be improved, so feel free to give any feedback.
Remember to give it a thumbs up if you like it.