DayImpulseOverlay_v1

DayImpulseOverlay_v1

This script is designed to serve as a visual overlay on your trading charts, providing a supplementary signal based on historical price momentum. Its primary goal is to help traders identify potential trends by calculating the "impulse" of price movement over a specific timeframe.

How the Logic Works

1. Data Aggregation and Calculation The tool looks at a predetermined number of past candles (defined by the "Period" setting). It calculates the difference between the opening and closing prices of these candles to determine the net momentum—essentially measuring how much "force" was behind the price movement during that time.

2. Forward Projection (The Signal) Once the impulse is calculated, the script projects that value forward onto the chart. Instead of showing you what just happened, it attempts to visualize where the price might head based on that accumulated momentum. This creates a "signal" line that appears ahead of the current live price.

3. Real-Time Dynamics The script offers two modes of operation:

  • Continuous Update: The signal constantly recalculates as every new price tick comes in, attempting to stay aligned with the most recent market activity.
  • Freeze Mode: The signal remains static, allowing you to observe a "snapshot" of the calculation without it moving in real-time.

Key Features for the Trader

  • Visual Signal: The script generates a distinct line (colored magenta by default) that acts as a guide. It combines the current price data with the calculated momentum to plot a potential path forward.
  • Shifted Perspective: By shifting the signal forward, it allows traders to see a projected "target" or "pathway," which can be used to identify potential areas of interest on the chart.

Important Usage Notes

Because this tool relies on calculating momentum from past data to project future movement, it is important to interpret the signals with caution. The script's own documentation warns that while the signal may appear to predict movements perfectly in hindsight (looking at old bars), the "future is not set." The most reliable information provided by the script is the current live bar, as the projected line is constantly being recalculated and updated by the underlying market volatility.

Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
DayImpulseOverlay_v1
/*
 * 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