Author: Yuriy Tokman
Japan

This script is a custom technical analysis tool designed for the MetaTrader platform to automatically identify and visualize specific price action patterns on a trading chart. Rather than using standard moving averages or oscillators, it scans historical price data (up to a user-defined limit) to detect structural shifts in candlestick behavior.

When the script runs, it evaluates each candle by comparing its opening, closing, high, and low prices against both itself and the preceding candle. It then places specific visual markers (arrows and symbols) on the chart to highlight five distinct types of market movements:

  • Bullish Hammer: Identifies candles with a small body at the top and a long lower wick, suggesting that sellers pushed price down, but buyers successfully drove it back up before the close.
  • Bullish Engulfing: Detects a situation where a large upward candle completely covers the body of the previous downward candle, often signaling a shift in momentum from bearish to bullish.
  • Bearish Engulfing: Conversely identifies a large downward candle that completely covers the body of the previous upward candle, highlighting a potential shift toward売り (selling) pressure.
  • Bearish Harami: Spots a specific "nested" pattern where a small downward candle follows a much larger upward candle, indicating a potential loss of momentum for the buyers.
  • Bullish Harami: Identifies a small upward candle following a large downward candle, suggesting that the selling pressure may be exhausting.
  • Doji: Highlights candles where the opening and closing prices are nearly identical. This represents market indecision, where neither buyers nor sellers could gain the upper hand.

Each pattern is assigned a unique visual style, including specific colors (such as Lime for bullish signals and Indigo for Dojis) and distinct arrow types. This allows traders to quickly scan large portions of history to identify potential reversal zones or trend continuations based on pure price action logic.

18 Views
0 Downloads
0 Favorites
Japan
//+------------------------------------------------------------------+
//|                                                   Japan.mq4 |
//|                                                     Yuriy Tokman |
//|                                            yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link      "yuriytokman@gmail.com"

#property indicator_chart_window
//---- input parameters
extern int       barsToProcess=1000;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
int i;
  
  
  
  for (i=0;i<Bars;i++)
    {
    ObjectDelete("Ïîâåøåííûé èëè ìîëîò "+DoubleToStr(i,0));
    ObjectDelete("áû÷üå ïîãëîùåíèå "+DoubleToStr(i,0));
    ObjectDelete("ìåäâåæüå ïîãëîùåíèå "+DoubleToStr(i,0));
    ObjectDelete("çàâåñà èç òåìíûõ îáëàêîâ "+DoubleToStr(i,0));
    ObjectDelete("ïðîñâåò â îáëàêàõ "+DoubleToStr(i,0));
    ObjectDelete("äîäæ "+DoubleToStr(i,0));
    }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted(),
//----
   limit,
   i=0; 
   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
   if(limit>barsToProcess)
      limit=barsToProcess;

   while (i<limit)
   {           
                                 //Ïîâåøåííûé èëè ìîëîò
      double k = (High[i]-Low[i])/3;
      if ((Open[i]>(Low[i]+2*k))&&(Close[i]>(Low[i]+2*k)))
       {
        ObjectCreate("Ïîâåøåííûé èëè ìîëîò "+DoubleToStr(i,0),OBJ_ARROW,0,Time[i],High[i]+10*Point);
        ObjectSet("Ïîâåøåííûé èëè ìîëîò "+DoubleToStr(i,0),OBJPROP_ARROWCODE,108);
        ObjectSet("Ïîâåøåííûé èëè ìîëîò "+DoubleToStr(i,0),OBJPROP_COLOR,DimGray);
       }            
                                //áû÷üå ïîãëîùåíèå
      if((Open[i+1]>Close[i+1])&&(Close[i+1]>Open[i])&&(Close[i]>Open[i+1]))
       {
        ObjectCreate("áû÷üå ïîãëîùåíèå "+DoubleToStr(i,0),OBJ_ARROW,0,Time[i],Low[i]-15*Point);
        ObjectSet("áû÷üå ïîãëîùåíèå "+DoubleToStr(i,0),OBJPROP_ARROWCODE,110);
       }            
                               //ìåäâåæüå ïîãëîùåíèå
       if((Close[i+1]>Open[i+1])&&(Open[i]>Close[i+1])&&(Open[i+1]>Close[i]))
       {
        ObjectCreate("ìåäâåæüå ïîãëîùåíèå "+DoubleToStr(i,0),OBJ_ARROW,0,Time[i],High[i]+15*Point);
        ObjectSet("ìåäâåæüå ïîãëîùåíèå "+DoubleToStr(i,0),OBJPROP_ARROWCODE,110);
        ObjectSet("ìåäâåæüå ïîãëîùåíèå "+DoubleToStr(i,0),OBJPROP_COLOR,Lime);
       }
                               //çàâåñà èç òåìíûõ îáëàêîâ
       if((Open[i+1]<Close[i+1])&&(Open[i]>High[i+1])&&(Close[i]<(Open[i+1]+(Close[i+1]-Open[i+1])/2)))
       {
        ObjectCreate("çàâåñà èç òåìíûõ îáëàêîâ "+DoubleToStr(i,0),OBJ_ARROW,0,Time[i],High[i]+25*Point);
        ObjectSet("çàâåñà èç òåìíûõ îáëàêîâ "+DoubleToStr(i,0),OBJPROP_ARROWCODE,116);
        ObjectSet("çàâåñà èç òåìíûõ îáëàêîâ "+DoubleToStr(i,0),OBJPROP_COLOR,Lime);
       }
                               //ïðîñâåò â îáëàêàõ
       if((Open[i+1]>Close[i+1])&&(Low[i+1]>Open[i])&&(Close[i]>(Close[i+1]+(Open[i+1]-Close[i+1])/2)))
       {
        ObjectCreate("ïðîñâåò â îáëàêàõ "+DoubleToStr(i,0),OBJ_ARROW,0,Time[i],Low[i]-25*Point);
        ObjectSet("ïðîñâåò â îáëàêàõ "+DoubleToStr(i,0),OBJPROP_ARROWCODE,116);
       }
                               //äîäæ
       if(Open[i]==Close[i])
       {
        ObjectCreate("äîäæ "+DoubleToStr(i,0),OBJ_ARROW,0,Time[i],High[i]+30*Point);
        ObjectSet("äîäæ "+DoubleToStr(i,0),OBJPROP_ARROWCODE,174);
        ObjectSet("äîäæ "+DoubleToStr(i,0),OBJPROP_COLOR,Indigo);
       }
     i++;  
   }

//----
   return(0);
  }





































//+------------------------------------------------------------------+

Comments