Ergodic Signals_v3
Download scriptThis script is designed to act as a visual navigation tool for traders, helping to identify potential entry points in the market by detecting shifts in momentum. Instead of cluttering the screen with complex lines or numbers, it translates mathematical data into simple, actionable visual cues—specifically arrows—directly on your price chart.
How the Logic Works
The script functions by analyzing a secondary technical tool known as the "Ergodic Oscillator." It looks at two specific components of this oscillator: the main momentum value and its corresponding signal line. By comparing these two values against each other, the script identifies "crossovers," which often suggest a change in the market's direction.
Key Functionalities
- Trend Identification: The logic continuously monitors the relationship between the main data and the signal line. When the momentum moves from below to above the signal line, it suggests an upward shift. Conversely, when it moves from above to below, it suggests a downward shift.
- Visual Signaling: To make these shifts easy to see at a glance:
- Blue Arrows: These appear on the chart when the logic detects a potential upward move.
- Red Arrows: These appear when the logic detects a potential downward move.
- Precision Positioning: The script is designed to place these arrows at a specific distance from the price candles (defined by a customizable offset). This ensures that the signals are clearly visible and do not overlap with the actual price action, keeping your chart clean and easy to read.
- Customizable Sensitivity: The logic includes several adjustable parameters that allow users to fine-tune how "fast" or "slow" the indicator reacts. You can modify the periods and smoothing modes to suit different trading styles, whether you prefer catching quick fluctuations or following long-term trends.
Summary for the User
In short, this script does the heavy lifting of calculating complex momentum oscillations in the background. It then filters that data to "ping" you with visual alerts whenever a significant shift occurs, helping you stay aligned with the current market trend without having to manually interpret multiple data points simultaneously.
//+------------------------------------------------------------------+
//| 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 Blue
#property indicator_color2 Red
//---- 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,233);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexLabel(0,"UpArrow");
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,234);
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]+ArrowShift*Point;
if ((curErgodic<curSignal)&&(prevErgodic>prevSignal)) ExtMapBuffer2[i]=Close[i]-ArrowShift*Point;
}
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
Comments