Author: Copyright � 2008, Limstylz
Doji

This tool is designed to monitor live financial charts and automatically identify a specific type of candlestick pattern known as a "Doji." By scanning the historical price action, the script highlights moments where the opening and closing prices are identical, which often suggests market indecision or a potential shift in trend.

How it Works

1. Real-Time Monitoring The script constantly tracks the movement of the market. It is programmed to recognize the specific timeframe you are currently viewing (ranging from 1-minute charts up to monthly charts) and ensures that it only processes new data as it arrives, preventing redundant calculations on the same candle.

2. Statistical Contextualization Rather than looking at a single price point in isolation, the script performs a small "neighborhood" analysis. It examines the last 10 candles to calculate the average height (the volatility) of the price bars. This allows the tool to understand the relative scale of the current market movement.

3. Pattern Detection The core logic focuses on identifying the Doji. The script looks for instances where the price at the start of a candle is exactly equal to the price at the end of that same candle. When this specific condition is met, it confirms that there was no significant net movement during that period.

4. Visual Notification Once a Doji is identified, the script places a clear visual marker (a yellow arrow) directly above the high point of that candle. The position of the arrow is dynamically adjusted based on the average height calculated in the previous step; this ensures that the marker remains clearly visible and doesn't overlap with the price bars, regardless of whether the market is currently experiencing high or low volatility.

In essence, this script serves as an automated "eye" that filters through constant price fluctuations to pinpoint moments of equilibrium, marking them visually so you can more easily identify potential turning points in the market.

Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
Doji
//+---------------------------------------------+
//|                              DojiAlarm.mq4  |
//|                 Copyright © 2008, Limstylz  |
//+---------------------------------------------+
#property copyright "Copyright © 2008, Limstylz"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
#property indicator_width1 5
double Arrow[];
int init() 
{
SetIndexStyle(0, DRAW_ARROW);
SetIndexArrow(0, 242);
SetIndexBuffer(0, Arrow);      
return(0);
}
int deinit() 
{
ObjectsDeleteAll(0, OBJ_TEXT);
return(0);
}
int start()
{
double Height, AvgHeight;
static datetime hist = 0;
int Counter,Current_Bar,Last_Bar,alert = 0;
double Doji_Open,Doji_Close;
string timeframe;
if(hist == Time[0]) 
{
return(0);
}
hist = Time[0];
switch(Period()) 
{
case 1:     timeframe = "M1";  break;
case 5:     timeframe = "M5";  break;
case 15:    timeframe = "M15"; break;
case 30:    timeframe = "M30"; break;      
case 60:    timeframe = "H1";  break;
case 240:   timeframe = "H4";  break;
case 1440:  timeframe = "D1";  break;
case 10080: timeframe = "W1";  break;
case 43200: timeframe = "MN";  break;
}
for(Current_Bar = 0; Current_Bar < Bars; Current_Bar++) 
{
Counter = Current_Bar;
Height = 0;
AvgHeight = 0;
for(Counter = Current_Bar; Counter <= Current_Bar + 9; Counter++) 
{
AvgHeight = AvgHeight + MathAbs(High[Counter] - Low[Counter]);
}
Height = AvgHeight / 10;
Last_Bar = Last_Bar + 1;
Doji_Open = Open[Last_Bar];
Doji_Close = Close[Last_Bar];
if(Doji_Close == Doji_Open)
{
Arrow[Last_Bar] = High[Last_Bar] + Height*1;
//PlaySound ("alert.wav");
}
}
return(0);
}
//----End

Comments