XaosExplorer
Download scriptThe XAOS Patterns Explorer is a specialized visual analysis tool designed to help traders identify significant price movements and potential market shifts by comparing historical price points against current data.
Core Operational Logic
The script functions by analyzing the relative change in price over a specific window of time, defined by a "Separation" setting. Instead of looking at simple point-to-point movements, it evaluates the mathematical ratio between the current market price and the price from a set number of bars ago.
How it Identifies Patterns
The tool monitors four key components of market data simultaneously:
- Closing Prices
- Opening Prices
- High Prices
- Low Prices
By calculating the ratio of these values, the indicator determines if a specific price point has deviated significantly from its historical counterpart. It uses two primary threshold levels (upper and lower bounds) to filter out minor market "noise" and highlight only the most impactful movements.
Signal Generation
The logic is structured to provide clear visual cues for potential trading opportunities based on these deviations:
- Buy Signals: These are triggered when the calculated price ratio exceeds a specific upper threshold. If any of the four data points (High, Low, Open, or Close) show a significant upward surge relative to the past timeframe, the tool marks a signal.
- Sell Signals: Conversely, these are triggered when the price ratio falls below a specific lower threshold. When the market shows a significant downward drop compared to the historical data point, the tool identifies it as a sell signal.
Visual and Audible Alerts
To ensure the trader can react in real-time, the script provides several layers of feedback:
- Visual Plotting: It draws lines and specific arrow symbols on the chart to indicate exactly where these price patterns have occurred.
- Dynamic Alerts: The tool includes an optional alarm system. If enabled, it will generate a pop-up notification containing the exact time and symbol of the market movement as soon as the pattern is detected.
Customization for Users
The logic allows for high levels of personalization through adjustable parameters:
- Separation: Adjusts how far back in time the script looks to compare prices.
- Sensitivity Levels: Users can fine-tune the "vividness" of the patterns by adjusting the threshold constants, allowing for either very strict (conservative) or very sensitive (aggressive) signal detection.
//+------------------------------------------------------------------+
//| XAOS PATTERNS EXPLORER |
//| bY Edward Samokhvalov |
//| (c) 9.4.2007 |
//+------------------------------------------------------------------+
#property copyright "Edward Samokhvalov"
#property indicator_separate_window
//----
#property indicator_buffers 6
#property indicator_color1 Gray
#property indicator_color2 Yellow
#property indicator_color3 Silver
#property indicator_color4 Gold
#property indicator_color5 Tomato
#property indicator_color6 LimeGreen
#property indicator_level1 1.0010 // I believe playing around with these constants
#property indicator_level2 0.999 // can make patterns appear more vivid as well as unvivid.
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
extern int Separation=15;
extern int AlarmOn=false;
extern int SHOW_SIGNALS=true;
extern double indicator_lev1 =1.0010; // I believe playing around with these constants
extern double indicator_lev2= 0.999; // can make patterns appear more vivid as well as unvivid.
//----
double buff2[];
double buff3[];
double buff4[];
double buff1[];
double buy[];
double sell[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,buff1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,buff2);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,buff3);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,buff4);
//----
SetIndexStyle(4,DRAW_ARROW,0,4);
SetIndexBuffer(4,buy);
SetIndexArrow(4,119);
//----
SetIndexStyle(5,DRAW_ARROW,0,4);
SetIndexBuffer(5,sell);
SetIndexArrow(5,119);
IndicatorShortName(" "+Separation+" ");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(Bars<=Separation) return(0);
int pos=0;
int barsToCount=Bars - counted_bars;
//---- initial zero
if(counted_bars<1)
for(int i=1;i<=Separation;i++)
{
buff1[Bars-i]=0.0;
buff2[Bars-i]=0.0;
buff3[Bars-i]=0.0;
buff4[Bars-i]=0.0;
buy[Bars-i]=0.0;
sell[Bars-i]=0.0;
}
//----
pos=Bars-Separation-1;
if(counted_bars>=Separation) pos=Bars-counted_bars-1;
//----
while(pos>=0)
{
buff1[pos]=Close[pos+Separation]/Close[pos];
buff2[pos]=Open[pos+Separation]/Open[pos];
buff3[pos]=High[pos+Separation]/High[pos];
buff4[pos]=Low[pos+Separation]/Low[pos];
if (SHOW_SIGNALS==true)
{
// SELL SIGNAL
if (buff1[pos] > indicator_lev1)
{
buy[pos]=buff1[pos];
sig("["+TimeToStr(CurTime())+"] " + Symbol() + ": BUY!)",pos);
}
else if (buff2[pos] > indicator_lev1)
{
buy[pos]=buff2[pos];
sig("["+TimeToStr(CurTime())+"] " + Symbol() + ": BUY!)",pos);
}
else if(buff3[pos] > indicator_lev1)
{
buy[pos]= buff3[pos];
sig("["+TimeToStr(CurTime())+"] " + Symbol() + ": BUY!)",pos);
}
else if (buff4[pos] > indicator_lev1)
{
buy[pos]=buff4[pos];
sig("["+TimeToStr(CurTime())+"] " + Symbol() + ": BUY!)",pos);
}
// BUY SIGNAL
else if (buff1[pos] < indicator_lev2)
{
sell[pos]=buff1[pos];
sig("["+TimeToStr(CurTime())+"] " + Symbol() + ": SELL!)",pos);
}
else if (buff2[pos] < indicator_lev2)
{
sell[pos]=buff2[pos];
sig("["+TimeToStr(CurTime())+"] " + Symbol() + ": SELL!)",pos);
}
else if(buff3[pos] < indicator_lev2)
{
sell[pos]= buff3[pos];
sig("["+TimeToStr(CurTime())+"] " + Symbol() + ": SELL!)",pos);
}
else if (buff4[pos] < indicator_lev2)
{
sell[pos]=buff4[pos];
sig("["+TimeToStr(CurTime())+"] " + Symbol() + ": SELL!)",pos);
}
}
pos--;
}
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void sig(string msg, int p)
{
if (AlarmOn==true && TimeToStr(Time[p])==TimeToStr(CurTime()))Alert(msg);
}
//+------------------------------------------------------------------+
Comments