DDFX 8 Sentiment v3
Download scriptThis "Market Sentiment" indicator is designed to provide traders with a visual representation of the prevailing momentum and trend direction in the market. Rather than just showing price movements, it processes three distinct layers of financial data to categorize the current market state into specific sentiments.
Core Analytical Components
The tool operates by analyzing three different types of mathematical indicators simultaneously:
- Relative Strength Analysis: It utilizes a standard momentum oscillator to measure how strongly the price is moving in a particular direction over a short period. This helps identify the "heartbeat" of the current price action.
- Moving Average Crossover Dynamics: The script looks at two separate exponential moving averages—one shorter and one longer. By calculating the difference between these two averages, it determines the speed and trajectory of the overall trend.
- Momentum Tracking: It compares the current relationship between these moving averages against their previous values to see if the trend is accelerating, slowing down, or reversing.
How the Logic Works
The indicator scans historical data to determine which "sentiment" to display on your chart based on specific conditions:
- Bullish Sentiment (Blue): The script identifies a positive sentiment when the momentum oscillator is above zero and the moving average difference is currently increasing compared to the previous period. This suggests that the upward price movement has both strength and accelerating velocity.
- Bearish Sentiment (Red): Conversely, it identifies a negative sentiment when the momentum oscillator falls below zero and the moving average difference is decreasing. This indicates that downward pressure is gaining strength.
- Neutral/Mixed Sentiment (Pale Green): If the data does not meet the specific criteria for a clear bullish or bearish trend—for instance, if the momentum is positive but the averages are weakening—the indicator displays a neutral state.
Visual Output
The result is presented as a three-color histogram in a separate window below your price chart. This allows you to quickly distinguish between active trending environments and periods of consolidation or indecision at a glance.
/*
Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
Website: http://purebeam.biz
E-mail : purebeam@gmail.com
*/
#property copyright "Market Sentiment"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 PaleGreen
int g_period_76 = 50;
int g_period_80 = 144;
int g_period_84 = 233;
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];
double gd_100;
double gd_108;
double g_icci_116;
int init() {
IndicatorBuffers(3);
SetIndexBuffer(0, g_ibuf_88);
SetIndexStyle(0, DRAW_HISTOGRAM);
SetIndexBuffer(1, g_ibuf_92);
SetIndexStyle(1, DRAW_HISTOGRAM);
SetIndexBuffer(2, g_ibuf_96);
SetIndexStyle(2, DRAW_HISTOGRAM);
IndicatorShortName("MARKET SENTIMENT");
return (0);
}
int deinit() {
return (0);
}
int start() {
int l_ind_counted_0 = IndicatorCounted();
if (l_ind_counted_0 < 0) return (-1);
int li_4 = Bars - l_ind_counted_0;
if (li_4 > Bars) li_4 = Bars;
for (int li_8 = li_4; li_8 >= 0; li_8--) {
g_icci_116 = iCCI(NULL, 0, g_period_76, PRICE_TYPICAL, li_8);
gd_100 = iMA(NULL, 0, g_period_80, 0, MODE_EMA, PRICE_CLOSE, li_8) - iMA(NULL, 0, g_period_84, 0, MODE_EMA, PRICE_CLOSE, li_8);
gd_108 = iMA(NULL, 0, g_period_80, 0, MODE_EMA, PRICE_CLOSE, li_8 + 1) - iMA(NULL, 0, g_period_84, 0, MODE_EMA, PRICE_CLOSE, li_8 + 1);
g_ibuf_88[li_8] = 0.0;
g_ibuf_92[li_8] = 0.0;
g_ibuf_96[li_8] = 0.0;
if (g_icci_116 > 0.0 && gd_100 > gd_108) g_ibuf_88[li_8] = 1.0;
else {
if (g_icci_116 < 0.0 && gd_100 < gd_108) g_ibuf_92[li_8] = 1.0;
else g_ibuf_96[li_8] = 1.0;
}
}
return (0);
}
Comments