bsi_trend
Download scriptThis script is a sophisticated technical analysis tool designed for MetaTrader to identify market trends, potential reversals, and price channels. Rather than simply looking at raw price movement, it combines several mathematical concepts—including linear regression, volume weighting, and range analysis—to create a "smoothed" view of market behavior.
Here is a breakdown of the core logic used by the script:
1. Dynamic Channel Construction
The script identifies high and low price boundaries over a specific period to define the "trading area." It doesn't just take the highest/lowest points; it uses a linear regression calculation to determine the mathematical path of the trend. This allows the tool to distinguish between actual structural moves and minor price fluctuations (noise).
2. The "Tango" Framework
The heart of the script relies on two primary calculated lines:
- Tango Line: This acts as a dynamic equilibrium point, representing the median of the current price channel.
- Tango MA (Moving Average): A smoothed version of the Tango Line that helps traders visualize the underlying momentum. By comparing the current price to these lines, the script can identify whether the market is overextended or trending strongly in one direction.
3. Smart Reversal Detection
The script includes a "Noise Filter" to prevent false signals. It searches for specific Reversal Bars—points where the price structure significantly changes (e.g., a bottom turning into a top). To ensure these aren't just random spikes, the script requires the price move to exceed a minimum spread before it validates the reversal as a significant trend shift.
4. Volume Weighting
One of the more advanced features is the ability to weight the calculations based on trading volume. If enabled, the script gives more "importance" to price moves that occur with high volume. This helps filter out low-liquidity movements, ensuring that the trend lines and reversal signals are backed by significant market activity.
5. The BSI (Balanced Sentiment Index)
The script calculates a proprietary BSI value. This index measures the balance between "positive" and "negative" price pressure. It looks at:
- How much price is pushing toward the upper boundary of the channel.
- How much price is pulling toward the lower boundary.
- The velocity of these moves relative to the Tango MA.
By balancing these factors, the BSI provides a sentiment score that indicates whether the current "push" in the market has enough strength to maintain the trend or if it is losing steam.
Summary of Visual Output
For the end user, the script translates all this complex math into:
- Trend Lines: Visual representations of the upper and lower boundaries of the market.
- Signal Arrows: Dynamic markers that appear when the logic detects a confirmed reversal bar (potential entry or exit points).
- Smoothing Buffers: Lines that show the "fair value" of the price at any given time, helping to filter out market "jitter."
ÿþ/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
/ / | B S I _ T r e n d . m q 4 |
/ / | B S I _ T r e n d C o p y r i g h t 2 0 1 5 , f x b o r g |
/ / | h t t p : / / f x b o r g - l a b o . h a t e b l o . j p / |
/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
# p r o p e r t y c o p y r i g h t "