Ergodic_Signals
Download scriptThis tool is designed to provide visual trading signals directly on your price chart by analyzing the relationship between two distinct components of the Ergodic Oscillator. Instead of requiring you to manually interpret complex moving lines, this script automates the detection of specific "crossovers" to highlight potential market turning points.
How the Logic Works
The script functions by constantly comparing two different data streams from the Ergodic Oscillator:
- The Main Line (Ergodic): The primary momentum indicator.
- The Signal Line: A smoothed secondary line used as a benchmark for the main line's movement.
By monitoring these two lines simultaneously, the script looks for specific moments where they intersect. It treats these intersections as "triggers" for the market:
- Buy Signals (Upward Arrows): The script identifies a bullish signal when the Main Line crosses from below to above the Signal Line. When this happens, it places an upward-pointing arrow on your chart to indicate potential upward momentum.
- Sell Signals (Downward Arrows): Conversely, the script identifies a bearish signal when the Main Line crosses from above to below the Signal Line. It then places a downward-pointing arrow to suggest potential downward momentum.
Key Features and Customization
The logic is built to be highly responsive while remaining smooth, thanks to several adjustable parameters:
- Sensitivity Settings: You can adjust the primary calculation periods (First_R, Second_S, and SignalPeriod) to make the signals faster or slower depending on your trading style.
- Smoothing: The script includes a smoothing mode to help filter out minor market "noise," ensuring that the arrows only appear during significant trend shifts rather than every small price flicker.
- Visual Clarity: The arrows are automatically offset from the actual price candles (via the ArrowShift parameter). This ensures that the signals do not overlap with the price bars, making them easy to see clearly on your screen.
In summary, this script acts as an automated "alert" system that simplifies technical analysis by distilling complex oscillator movements into clear, visual cues for entering or exiting a trade.
//+------------------------------------------------------------------+
//| TSI Signals.mq4 |
//| Copyright © 2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 MediumBlue
//---- input parameters
extern int First_R=8;
extern int Second_S=5;
extern int SignalPeriod=5;
extern int Mode_Smooth=1;
extern int ArrowShift=5;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,217);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexLabel(0,"UpArrow");
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,218);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexLabel(1,"DownArrow");
SetIndexEmptyValue(1,0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit,i;
double curErgodic=0.0,prevErgodic=0.0,curSignal=0.0,prevSignal=0.0;
limit=Bars-counted_bars-First_R-Second_S-SignalPeriod;
for (i=limit;i>=0;i--)
{
curErgodic=iCustom(NULL,0,"Ergodic_Oscillator",First_R,Second_S,SignalPeriod,Mode_Smooth,0,i);
prevErgodic=iCustom(NULL,0,"Ergodic_Oscillator",First_R,Second_S,SignalPeriod,Mode_Smooth,0,i+1);
curSignal=iCustom(NULL,0,"Ergodic_Oscillator",First_R,Second_S,SignalPeriod,Mode_Smooth,1,i);
prevSignal=iCustom(NULL,0,"Ergodic_Oscillator",First_R,Second_S,SignalPeriod,Mode_Smooth,1,i+1);
if ((curErgodic>curSignal)&&(prevErgodic<prevSignal)) ExtMapBuffer1[i]=Close[i]+3*ArrowShift*Point;
if ((curErgodic<curSignal)&&(prevErgodic>prevSignal)) ExtMapBuffer2[i]=Close[i]-ArrowShift*Point;
}
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
Comments