Ergodic Signals_v1
Download scriptThis indicator is designed to provide visual trading signals directly on your price chart by analyzing specific momentum movements. Its primary purpose is to identify potential entry points by comparing two different data streams derived from the "Ergodic Oscillator."
How the Logic Works
The tool operates by monitoring the relationship between a main oscillator line (the primary signal) and its corresponding signal line (the smoothed average). It looks for specific "crosses" where these two lines intersect, which often indicates a shift in market momentum.
1. The Main Components
- Ergodic Oscillator: This is the foundation of the tool. It processes historical price data to determine the current strength and direction of a trend.
- Signal Line: This is a secondary, smoother calculation based on the Ergodic Oscillator. It acts as a reference point to help filter out "noise" or minor price fluctuations.
2. Identifying Buy Signals (Upward Arrows) The script scans every new candle to see if the main oscillator line moves from being below its signal line to moving above it. When this upward crossover occurs, the script places a visual arrow on the chart. This suggests that momentum is turning bullish and may indicate an opportunity to look for an upward price movement.
3. Identifying Sell Signals (Downward Arrows) Conversely, the script looks for instances where the main oscillator line moves from being above its signal line to moving below it. When this downward crossover occurs, the script places a visual arrow on the chart. This suggests that momentum is turning bearish and may indicate an opportunity to look for a downward price movement.
Key Visual Features
- Automatic Plotting: The signals are displayed as arrows directly above or below the price candles, making it easy for traders to see potential shifts at a glance without having to interpret complex lines independently.
- Customizable Positioning: The tool includes a "Shift" parameter that allows users to adjust how far the arrows appear from the actual price candle, ensuring they are clearly visible and do not clutter the price action.
In summary, this script automates the process of watching for momentum shifts. By identifying the exact moment when the primary oscillator breaks through its signal line, it highlights potential trend reversals or continuations in real-time.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| 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