DayImpulseOverlay

Download script
DayImpulseOverlay

This tool is designed to provide visual momentum analysis directly on your trading charts. It functions by calculating the "impulse"—or the net movement—of price action over a specific window of time and projecting that information forward to help identify potential trends.

Core Logic and Mechanics

1. Momentum Calculation The script looks at a user-defined number of historical price bars (the "period"). It calculates the difference between the opening and closing prices across these bars to determine the overall direction and strength of the market's movement during that window.

2. Data Projection (The "Shift") Rather than simply showing you what happened in the past, the tool takes that calculated momentum and shifts it forward on the chart. This creates a visual representation of how current price velocity might influence future movement. By offsetting this data, it allows traders to see a "preview" of the trend's path based on recent intensity.

3. Dynamic Updates vs. Historical Tracking The script includes a specific logic toggle for updates:

  • Continuous Update: The tool constantly recalculates as new price data arrives, updating both the current signal and the projected future signals in real-time.
  • Historical Snapshot: It preserves the "footprint" of previous calculations so that you can review how the signals evolved during past market sessions.

4. The Dual-Signal Concept The logic distinguishes between two types of information:

  • The Cumulative Signal: A broader look at the momentum over a larger period.
  • The Live Signal: A specific focus on the very last bar's movement. This is intended to be the most accurate "live" indicator, as it reacts to the most immediate price fluctuations.

Important Usage Note

Because this tool relies on mathematical projections of past momentum, it is designed for analysis rather than absolute prediction. The script highlights that while the visual lines may appear to "predict" the future perfectly in hindsight, they are constantly being recalculated by live market data. It serves as a momentum overlay to help traders gauge the current "pulse" of the market.

Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
DayImpulseOverlay
/*
 * Filename:    DayImpulseOverlay.mq4
 * Author:      DriverDan, based on the original by Tartan at the link below
 * Date:        Nov 3, 2005
 *
 * Description: This is Day Impulse overlaid on the main chart. Requires DayImpulse2DD.
 *
 *              Sums the close - open for the past "per" bars and shifts it forward
 *              "drawShift" bars. Sometimes works well at predicting movement.
 *
 *              Signal2 is just the current bar's close - open shifted "drawShift"
 *              periods forward. This is what you see as the main signal draws. It
 *              isn't updated as time moves forward so that you have something to look
 *              back on.
 *
 *              WARNING: Looking at past bars will be deceiving. It may look like it
 *              predicts perfectly on some pairs but remember that it is constantly
 *              updated. The most accurate live bar is the current one.
 *
 *              The future is not set.
 *
 * Version:     2DD
 *              Released by DriverDan
 *              Almost all of the code has been changed or rewritten.
 *              Added Signal2.
 *
 *              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
 *              Initial release
 *              http://www.arkworldmarket.ru/forum/showthread.php?t=966&page=2&pp=10
 */

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1  Magenta

extern int per    = 14;  // Period for signal
extern int update = 1;   // 1 = continuously update, 0 = freeze

// Buffers for signals
double drawBuffer[];
   
int init() {
   string title = "DayImplus(" + per + ")";
   
   SetIndexStyle(0, DRAW_LINE, 0, 2);
   SetIndexBuffer(0, drawBuffer);
   
   // Shift everything forward
   SetIndexShift(0, per);
   
   // Titles for each line
   SetIndexLabel(0, "Signal(" + per + ")");
   
   IndicatorShortName(title);
   return(0);
}

int start() {
   int    counted_bars = IndicatorCounted();
   int    shift, i, limit, lim;
   double prevSignal = -1, barClose = -1, imp;

   if(update == 1) {
      imp = iCustom(NULL, 0, "DayImpulse2DD", per, 0, 0, 0, 0, 0, per) * Point;

      barClose = Close[0] - iCustom(NULL, 0, "DayImpulse2DD", per, 0, per) * Point;

      // Loop through and calculate the signals. Everytime this runs we recalculate the
      // current and all future signals. The future is not set :)
      for(shift = per - 1; shift >= 0; shift--) {
         imp = iCustom(NULL, 0, "DayImpulse2DD", per, 0, shift) * Point;
         
         drawBuffer[shift] = barClose + imp;
      }
   }
      
   return(0);
}

Comments