Author: Copyright � 2005, DriverDan
DogiStars

This tool is designed to assist traders by automatically identifying specific candlestick patterns known as "Dogi stars" (specifically Morning and Evening Dogi stars) on a price chart. By scanning historical and real-time price data, the script highlights potential trend reversals or momentum shifts using visual markers.

Core Logic & Functionality

The script operates by analyzing the relationship between current and previous candlestick prices to detect three distinct types of signals:

1. Standard Dogi Identification The tool constantly monitors the price action to find "Dogis." It looks for specific structural conditions where a candle's opening price is exactly equal to its closing price (forming a flat top or bottom), combined with a significant price deviation from the previous candle:

  • Bullish Dogi: Identified when the current candle's low is lower than the previous candle's low.
  • Bearish Dogi: Identified when the current candle's high is higher than the previous candle's high.

When these are found, the script places a visual marker (a star) slightly above or below the candle to alert the trader.

2. Morning and Evening Dogi Stars Beyond simple Dogis, the script looks for more complex "Morning" and "Evening" configurations. These are often considered stronger signals because they involve a sequence of three candles showing a transition in momentum:

  • Morning Star Signal: The logic looks for a specific sequence where a bearish candle is followed by a Dogi star, which then transitions into a bullish candle. If this sequence is detected, the tool places an upward-pointing arrow to signify a potential move higher.
  • Evening Star Signal: Conversely, the script looks for a bullish candle followed by a bearish Dogi star, transitioning into a bearish candle. If this occurs, it places a downward-pointing arrow to signal a potential move lower.

Visual Presentation

To ensure the data is easy to read at a glance, the script uses three different types of visual markers:

  • Yellow Markers: Used to identify standard Dogi stars.
  • Red Up/Down Arrows: Specifically used to highlight the more significant Morning and Evening Dogi Star patterns.

The script is designed to process the chart history automatically, ensuring that as new candles form, the indicators remain updated and visible to the user.

Miscellaneous
Implements a curve of type %1
5 Views
0 Downloads
0 Favorites
DogiStars
/*
 * Filename:    DogiStars.mq4
 * Author:      DriverDan
 * Date:        Oct 28, 2005
 *
 * Description: Indicator that displays Dogis and Morning and Evening Dogi stars.
 *
 * Version:     1.0
 *              Initial release
 */

#property copyright "Copyright © 2005, DriverDan"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1  Yellow
#property indicator_color2  Red
#property indicator_color3  Red

#define UP                  1
#define DOWN                2

extern int showDogis      = 1;     // 1 = Show a star for Dogis
extern int showArrows     = 1;     // 1 = Arrows for morning and evening Dogi stars

double dogiBuffer[];
double upBuffer[];
double downBuffer[];

/*
 * Initialization function
 */
int init() {
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(0, 171);
   SetIndexArrow(1, 225);
   SetIndexArrow(2, 226);
   SetIndexBuffer(0, dogiBuffer);
   SetIndexBuffer(1, upBuffer);
   SetIndexBuffer(2, downBuffer);
   SetIndexLabel(0, "Dogi");
   SetIndexLabel(1, "Up Signal");
   SetIndexLabel(2, "Down Signal");
   return(0);
}

/*
 * Function to find a Dogi
 */
int findDogi(int i) {
   int retVal = 0;

   if(Low[i] < Low[i + 1] && Open[i] == Close[i]) {
      retVal = UP;
   } else if(High[i] > High[i + 1] && Open[i] == Close[i]) {
      retVal = DOWN;
   }
   
   return(retVal);
}

/*
 * Main program
 */
int start() {
   int i, dogiVal;
   int counted_bars = IndicatorCounted();

   if(Bars < 3) return(0);

   // Loop and look for pivots
   for(i = Bars - counted_bars; i >= 0; i--) {
      if(i < Bars - 3) {
         
         // If we are showing Dogis look for them
         if(showDogis == 1) {
            dogiVal = findDogi(i);
            
            // If we found a dogi mark it
            if(dogiVal == UP) {
               dogiBuffer[i] = Low[i] - 4 * Point;
            } else if(dogiVal == DOWN) {
               dogiBuffer[i] = High[i] + 4 * Point;
            }
         }
         
         // If we are showing morning and evening dogi stars look for them
         if(showArrows == 1) {
            dogiVal = findDogi(i + 2);

            // If we found a morning or evening dogi star mark it
            if(dogiVal == UP && Open[i + 3] > Close[i + 3] && Open[i + 1] < Close[i + 1]) {
               upBuffer[i + 1] = Low[i + 1] - 4 * Point;
            } else if(dogiVal == DOWN && Open[i + 3] < Close[i + 3] && Open[i + 1] > Close[i + 1]) {
               downBuffer[i + 1] = High[i + 1] + 4 * Point;
            }
         }
      }
   }

   return(0);
}

Comments