Author: Pipswanted
WavyDash

The WaveDash indicator is designed to provide visual signals on a trading chart by analyzing the relationship between current price action and specific moving average averages. Its primary goal is to identify momentum shifts by comparing where the price sits in relation to historical highs and lows over a customizable period.

Core Logic Overview

The script operates by scanning recent price data to determine the current market "sentiment." It looks at the closing price of a candle and measures it against two different types of moving averages: Simple Moving Averages (SMA) and Exponential Moving Averages (EMA).

How the Analysis Works

  1. Trend Identification: The indicator first checks if the current price is trading above a Simple Moving Average calculated from the "High" prices of previous candles. If it is, the system registers a bullish leaning. Conversely, if the price falls below a Simple Moving Average calculated from the "Low" prices, it registers a bearish leaning.
  2. State Tracking: The script maintains a "memory" of these signals. It doesn't just look at the current candle in isolation; it tracks whether the most recent significant move was upward or downward to help filter out minor price fluctuations (noise).
  3. Dynamic Calculation: Once a trend direction is confirmed, the indicator calculates a specific distance value based on the gap between the current close and an Exponential Moving Average of previous highs or lows.

Visual Output

The results of these calculations are plotted directly on your trading chart as two distinct lines:

  • Red Signals: These appear when the logic detects a downward bias. The line represents the calculated distance of the price from its recent structural low, helping to visualize the strength of a potential move downward.
  • Green Signals: These appear when the logic detects an upward bias. This line tracks the price's distance from its recent structural high, highlighting the momentum of a potential move upward.

By using both Simple and Exponential moving averages in tandem with "High" and "Low" price data, the indicator aims to provide a smoother representation of market trends than standard price action alone, highlighting areas where the market is stretching away from its average equilibrium.

Price Data Components
Series array that contains close prices for each bar
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
WavyDash
//+------------------------------------------------------------------+
//|                                                     WaveDash.mq4 |
//|                                                       Pipswanted |
//|                                           contact@pipswanted.com |
//+------------------------------------------------------------------+
#property copyright "Pipswanted"
#property link      "http://wwww.pipswanted.com"
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Green
extern int Back=10;
double red[],green[],one,two;
#property indicator_chart_window

int init()
  {
   SetIndexBuffer(0,red);
   SetIndexBuffer(1,green);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);

   return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
  
   ArrayInitialize( red, EMPTY_VALUE);
   ArrayInitialize( green, EMPTY_VALUE);
   for(int i=Bars-Back;i>=0;i--)
     {
      if(Close[i]>iMA(Symbol(),0,Back,0,MODE_SMA,PRICE_HIGH,i))
      {
         one=1;
      }   
      else
      {
         if(Close[i]<iMA(Symbol(),0,Back,0,MODE_SMA,PRICE_LOW,i))
            one=-1;
         else
            one=0;
      }
      
      if(one!=0)
      {
         two=one;
      }   
      if(two==-1)
      {
         double a = iMA(Symbol(),0,Back,0,MODE_EMA,PRICE_HIGH,i+1) - iClose(Symbol(), 0 ,i+2);
         red[i] = (iClose(Symbol(), 0 ,i) - a); 
      }
      else
      {
         double b = iClose(Symbol(), 0 ,i+2) - iMA(Symbol(),0,Back,0,MODE_EMA,PRICE_LOW,i+1);
         green[i] = (iClose(Symbol(), 0 ,i) + b);
      }
     }

   return(0);
  }

Comments