OPEN-SOURCE SCRIPT

Market structure

Hi all!

This script shows you the market structure. You can choose to show internal market structure (with pivots of a default length of 5) and swing market structure (with pivots of a default length of 50). For these two trends it will show you:
• Break of structure (BOS)
• Change of character (CHoCH) (mandatory)
• Equal high/low (EQH/EQL)

It's inspired by "Smart Money Concepts (SMC) [LuxAlgo]" by LuxAlgo that will also show you the market structure.

It will create the two market structures depending on the pivots found. Both of these market structures can be enabled/disabled. The pivots length can be configured separately. The pivots found will be the 'base' of this indicator and will show you when price breaks it. When that happens a break of structure or a change of character will be created. The latest 5 pivots found within the current trends will be kept to take action on. The internal market structure is shown with dashed lines and swing market structure is shown with solid lines.

A break of structure is removed if an earlier pivots within the same trend is broken. Like in the images below, the first pivot (in the first image) is removed when an earlier pivot's higher price within the same trend is broken (the second image):
لقطة

لقطة

Equal high/lows have a pink zone (by default but can be changed by the user). These zones can be configured to be extended to the right (off by default). Equal high/lows are only possible if it's not been broken by price and if a later bar has a high/low within the limit it's added to the zone (without it being more 'extreme' (high or low) then the previous price). A factor (percentage of width) of the Average True Length (of length 14) that the pivot must be within to to be considered an Equal high/low. This is configurable and sets this 'limit' and is 10 by default.

You are able to show the pivots that are used. "HH" (higher high), "HL" (higher low), "LH" (lower high), "LL" (lower low) and "H"/"L" (for pivots (high/low) when the trend has changed) are the labels used.

This script has proven itself useful for me to quickly see how the current market is. You can see the pivots (price and bar) where break of structure or change of character happens to see the current trends. I hope that you will find this useful for you.

When programming I focused on simplicity and ease of read. I did not focus on performance, I will do so if it's a problem (haven't noticed it is one yet).

You can set alerts for when a change of character happens. You can configure it to fire on when it happens (all or once per bar) but it defaults to 'once_per_bar_close' to avoid repainting. This has the drawback to alert you when the bar closes.

TLDR: this is an indicator showing you the market structure (break of structures and change of characters) using swing points/pivots. Two trends can be shown, internal (with pivots of length of 5) and swing (with pivots of the length of 50).

Best of trading luck!
marketstructurepriceactionsupportandresitanceTrend Analysis

نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الرمز في المنشور يخضع لقواعد‎‎قوانين الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟

إخلاء المسؤولية