DayImplus 1.1_v1

Download script
DayImplus 1.1_v1

This tool is designed to provide visual feedback on market momentum by analyzing price behavior over a specific timeframe. Instead of looking at just the most recent price action, it calculates a cumulative "imbalance" or "impulse" value to help traders identify trends more clearly.

Core Logic and Functionality

1. The Impulse Calculation The primary engine of this script looks back at a user-defined number of previous candles (the "Period"). For each of these candles, it measures the difference between the opening price and the closing price. By summing up these differences over the entire period, the tool determines the net direction of price movement.

2. Normalization and Orientation Once the total sum is calculated, the script converts that value into a rounded figure based on the smallest price fluctuations available in the market (Points). To ensure consistency, the logic applies a standardization step: if the resulting value is not zero, it ensures the signal reflects a specific directional orientation. This helps smooth out minor "noise" and focuses on significant movements.

3. Moving Average Smoothing To make the data easier to read and less erratic, the script includes an optional smoothing layer. If enabled, it applies a Simple Moving Average (SMA) to the calculated impulse values. This creates a secondary line that filters out sudden spikes, allowing for a clearer view of the broader trend rather than just the immediate volatility.

4. Visual Representation The results are displayed in a separate window below the main price chart. It provides two distinct visual elements:

  • The Signal Line: Represents the raw impulse calculation, showing the intensity of price movement over the chosen period.
  • The MA Line: Provides a smoothed trend overlay (when active), helping users distinguish between short-term fluctuations and sustained momentum.

Both lines are shifted forward on the chart by a configurable amount, which helps in aligning the visual data with the user's current perspective on the market timeline.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
DayImplus 1.1_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| DayImplus 1.1.mq4                                                |
//|                                                                  |
//| Updated by DriverDan                                             |
//|                                                                  |
//| Versions:                                                        |
//|   1.1 Released by DriverDan                                      |
//|       Fix horrible style, removed extra buffer, changed to draw  |
//|       from the beginning, added MA, and fixed gaps in signal.    |
//|                                                                  |
//|   1.0 Original Release                                           |
//+------------------------------------------------------------------+

#property link "http://www.arkworldmarket.ru/forum/showthread.php?t=966&page=2&pp=10"
   
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1  Gold
#property indicator_color2  White

extern int per       = 14;  // Period for signal
extern int drawShift = 14;  // Forward shift
extern int useMA     = 1;   // 1 = use MA
extern int maPeriod  = 34;  // Moving average period

double ExtMapBuffer[];
double maBuffer[];
   
int init() {
   string title = "DayImplus(" + per + ")";
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, ExtMapBuffer);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, maBuffer);
   SetIndexShift(0, drawShift);
   SetIndexShift(1, drawShift);
   SetIndexLabel(0, "Signal(" + per + ")");
   SetIndexLabel(1, "MA(" + maPeriod + ")");
   
   if(useMA == 1) {
      title = title + " MA(" + maPeriod + ")";
   }
   
   IndicatorShortName(title);
   return(0);
}

int start() {
   int    counted_bars = IndicatorCounted();
   int    shift, i;
   double imp;

   //for shift=mBar down to per 
   for(shift = Bars - counted_bars - 1; shift >= 0; shift--) {
      imp = 0;

      for(i = shift; i >= shift - per; i--) {
         imp = imp + (Open[i] - Close[i]);
      }

      imp = MathRound(imp / Point);

      if(imp != 0) {
         imp =- imp;
      }
      ExtMapBuffer[shift] = imp;
   }
   
   if(useMA == 1) {
      for(shift = Bars - counted_bars - 1; shift >= 0; shift--) {
         if(shift < Bars - maPeriod && shift < Bars - per) {
            maBuffer[shift] = iMAOnArray(ExtMapBuffer, 0, maPeriod, 0, MODE_SMA, shift);
         }
      }
   }
   
   return(0);
}

Comments