PROTECTED SOURCE SCRIPT

mentfx Structure

Updated
The indicator is designed to identify and track swing highs and lows in a given market on any timeframe, and display them on the chart as solid lines (the lines you see are denoting highs and lows). The lines are customizable in terms of color and width, as determined by the user input.

The rules for creating a new high or low are based on whether the current range is considered Bullish (most recent break being to the topside) or whether the current range is considered Bearish (most recent breaking being to the downside). If the range is Bullish, the code will allow for wicks below the low without updating the low, and will only change in the case that a candle's body (open or close) finds itself under that given low. If the range is Bearish, the code will allow for wicks above the high without updating the high, and will only change in the case that a candle's body (open or close) finds itself above that given high.

When a range is assigned as being bullish, it will continue updating the high until a swing high is created (denoting that as the high of the range) and will not update or change until a candle's body, open's or close's above it - which will reupdate the high and update the low. The low will be updated based on the last time price had a candle (open or closure) below a previous candles low, and then will find the lowest low after the rule was met to assign a low (the idea here is to locate the last major "sell before buy" and showcase that range. And this will occur vice versa, where: when a range is assigned as bearish, it will continue updating the low until a swing low is created (denoting that as the low of the range) and will not update or change until a candle's body, open's or close's below it - which will reupdate the low and update the high. The high will be updated based on the last time price had a candle (open or closure) above a previous candles high, and then will find the highest high after the rule was met to assign a high (once again, the idea being to locate the last major "buy before sell" and showcase price as existing in that range.

A swing high is considered as a high that has a lower high to its left and to its right. And a swing low is considered as a low that has a higher low to its left and to its right. These swings are used to determine the final high or low of a Bullish or Bearish range (respectively).

Additionally, the script includes a function that updates the lines on the chart as new market data prints (using the logic described above).

The indicator uses a specific method (mentioned above) based on the idea of "sells before buys" (for Bullish Ranges) and "buys before sells" (for Bearish Ranges) that isnt found in other indicator. The channels shown on the screen represent prior highs and lows, as well as current updated highs and lows based on this. The reason for using this way to track Structure is that we are assuming large money is selling before purchasing heavily, and buying before selling heavily, and these ranges attempt to showcase the structural delivery of price on any timeframe in reference to this theory - theory being that if we are in a bullish range, we are likely to sustain some sort of bullish move until the next high or for a while, or from the last "sell before buy" - and vice versa. As well as being able to merge the "context" or "story" of multiple timeframes in reference to this indicator as confluence for bullish or bearish continuations. Follow's the school of thought that comes with trend following.
Release Notes
Changed default color/thickness.
Changed some lines of code that would incorrectly (very rarely) mark the wrong swing low or swing high.
absorptionBands and Channelscandlebreaksmentfxpullbackrulestructureswinghighswinglow

Protected script

This script is published closed-source and you may privately use it freely.

Want to use this script on a chart?


Also on:

Disclaimer