XprofuterOverlay
Download scriptThe XprofuterOverlay is a visual analytics tool designed to provide traders with clearer market insights by projecting specific data signals directly onto the price chart. Instead of simply displaying raw numbers, it creates a visual representation that helps identify potential trends or key levels based on a secondary calculation engine.
Core Functionality
The primary purpose of this script is to take data from a specialized underlying indicator (known as "XprofuterDD") and overlay it onto your current price action. By calculating the relationship between the current market closing price and these specific signals, the tool creates a visual "path" or "offset." This allows you to see where the underlying logic suggests the price is reacting relative to the actual bars on your screen.
Key Features and Logic
- Dynamic Signal Projection: The script takes the data from the secondary indicator and adjusts it based on a user-defined timeframe (the Period). It then "shifts" this information forward, allowing you to visualize historical and current signals in a way that aligns with the visual flow of the chart.
- Real-Time Synchronization: You have the option to control how the tool behaves in real-time. It can be set to update continuously as each new tick of price data arrives, or it can be "frozen" to maintain a static view of the current signals.
- Visual Overlay: Rather than cluttering the screen with multiple windows, this script draws a specific line directly on your main chart window. This allows for an immediate visual comparison between the actual market price and the calculated signal level.
How it Works for the User
When you apply this tool, it automatically fetches the necessary data from the "XprofuterDD" engine. It calculates the distance between the current closing price and the signal value provided by that engine, then draws a magenta line that represents this adjusted position. This helps traders quickly identify whether the market is deviating from the expected signal or following it closely, making it easier to spot opportunities at a glance.
//+------------------------------------------------------------------+
//| |
//| Filename: XprofuterOverlay |
//| |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Magenta
//----
extern int per =14; // Period for signal
extern int update=1; // 1 = continuously update, 0 = freeze
// Buffers for signals
double drawBuffer[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
string title="XProfuter(" + per + ")";
//----
SetIndexStyle(0, DRAW_LINE, 0, 2);
SetIndexBuffer(0, drawBuffer);
// Shift everything forward
SetIndexShift(0, per);
// Titles for each line
SetIndexLabel(0, "Signal(" + per + ")");
IndicatorShortName(title);
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int shift, i, limit, lim;
double prevSignal=-1, barClose=-1, imp;
//----
if(update==1)
{
imp=iCustom(NULL, 0, "XprofuterDD", per, 0, 0, 0, 0, 0, per) * Point;
barClose=Close[0] - iCustom(NULL, 0, "XprofuterDD", per, 0, per) * Point;
// Loop through and calculate the signals. Everytime this runs we recalculate the
// current and all future signals. The future is not set :)
for(shift=per - 1; shift>=0; shift--)
{
imp=iCustom(NULL, 0, "XprofuterDD", per, 0, shift) * Point;
drawBuffer[shift]=barClose + imp;
}
}
return(0);
}
//+------------------------------------------------------------------+
Comments