This tool is designed to provide visual insights into market momentum by calculating the difference between two specific price signals. Instead of showing standard price movements, it focuses on a mathematical variance derived from an external calculation model known as the "TriggerLine."
How the Logic Works
The script operates by performing a constant comparison between two distinct data streams:
- Data Source Integration: The logic reaches out to a secondary calculation (the TriggerLine) and pulls two different values for every point on the chart.
- Comparative Calculation: It identifies "Value A" and "Value B" from these sources at each specific moment in time.
- The Difference Engine: The core functionality of the script is to subtract "Value B" from "Value A." By calculating this difference, the tool highlights the "gap" or "spread" between these two signals.
- Visual Representation: This resulting difference is then plotted as a histogram in a separate window.
Key Characteristics
- Momentum Tracking: Because it measures the distance between two moving signals, the resulting histogram shows how much tension or movement exists between them. When the bars expand, it indicates an increasing gap; when they shrink, it indicates the signals are converging.
- Customizable Sensitivity: The logic allows for adjustments to the underlying periods and divisors, which determines how "smooth" or "reactive" the resulting histogram appears on your screen.
- Trend Visualization: By focusing on the variance rather than just the price, the script helps traders see the acceleration or deceleration of a trend more clearly than a standard price chart might allow.
//+------------------------------------------------------------------+
//| Elliott Wave Oscillator.mq4 |
//| tonyc2a@yahoo.com |
//| |
//+------------------------------------------------------------------+
#property copyright "tonyc2a@yahoo.com"
#property link ""
#property indicator_separate_window
#property indicator_color1 DeepPink
//---- buffers
double Buffer1[];
extern int Rperiod = 48;
extern int LSMA_Period = 5;
extern int Div = 3;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexBuffer(0,Buffer1);
SetIndexLabel(0,"EWO");
//----
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();
double TL1,TL2;
//---- TODO: add your code here
for(int i=Bars;i>=0;i--){
TL1=iCustom(NULL,0,"TriggerLine",Rperiod,LSMA_Period,Div,0,i);
TL2=iCustom(NULL,0,"TriggerLine",Rperiod,LSMA_Period,Div,1,i);
Buffer1[i]=TL1-TL2;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments