ZeroLagStochsSignals_002
Download scriptThis technical tool is designed to assist traders in identifying specific momentum shifts by analyzing the relationship between two different data streams from a "Zero Lag Stochastic" oscillator. Instead of just looking at where the price is going, this script monitors how the primary trend and the secondary signal lines interact with each other to highlight potential entry or exit points.
How the Logic Works
The script continuously scans the historical price data to look for specific "crossover" events. It focuses on three distinct values: a previous point in time, the current main signal, and the current secondary signal.
1. Identifying Sell Opportunities (Red Signals) The tool looks for a specific downward momentum shift. If the previous value was higher than the main signal, but the current value has dropped below that main signal, the script recognizes this as a "cross-down" event. When this occurs, it places a red visual marker above the price candles to alert you to a potential selling opportunity.
2. Identifying Buy Opportunities (Green Signals) Conversely, the tool monitors for an upward momentum shift. If the previous value was lower than the main signal, but the current value has risen above it, the script identifies a "cross-up" event. It then places a green visual marker below the price candles to highlight a potential buying opportunity.
Key Features
- Visual Alerts: The script translates complex mathematical crosses into simple visual cues (arrows) directly on your trading chart, making it easier to see market trends at a glance.
- Real-Time Notifications: You can choose whether you want the system to send active pop-up alerts. If enabled, the tool will provide an immediate notification whenever a Buy or Sell cross is detected on the current live candle.
- Automated Scanning: The logic automatically calculates these crossovers across a large window of historical data, ensuring that all previous signals are plotted accurately while remaining responsive to live price movements.
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_color2 Red
//---- input parameters
extern int a=14;
extern int alerty=0; // 0 for alerts 1 for no alerts
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double b4zls,nowzls,nowzlsmain;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW,EMPTY);
SetIndexArrow(0,233);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexStyle(1,DRAW_ARROW,EMPTY);
SetIndexArrow(1,234);
SetIndexBuffer(1, ExtMapBuffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//ObjectDelete("");
//ObjectDelete("down cross");
//ObjectDelete(0,233);
//ObjectDeleteEx(0, DRAW_ARROW,0,0,0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=1000-counted_bars;
//---- macd counted in the 1-st buffer
for(int i=limit; i>=0; i--)
{
b4zls=iCustom(NULL,0,"ZeroLagStochs",0,i+1);
nowzls=iCustom(NULL,0,"ZeroLagStochs",0,i);
nowzlsmain=iCustom(NULL,0,"ZeroLagStochs",1,i);
if(b4zls>nowzlsmain &&
nowzls<nowzlsmain)
{
ExtMapBuffer2[i]=High[i]+7*Point;
if (alerty==0 && i<2 ) Alert(Symbol()," ",Period()," ZeroLagStochs Cross SELL");
}
if(b4zls<nowzlsmain &&
nowzls>nowzlsmain)
{
ExtMapBuffer1[i]=Low[i]-5*Point;
if (alerty==0 && i<2) Alert(Symbol()," ",Period()," ZeroLagStochs Cross BUY");
}
}
//----
return(0);
}
Comments