iKarakatica

Download script
iKarakatica

This indicator is designed to identify potential trend reversals or momentum shifts by analyzing price movement in relation to specific directional strength metrics. Instead of showing a continuous line, it places visual markers (arrows) on your chart to highlight specific moments where conditions for a move are met.

Core Logic and Functionality

The script operates based on three primary components: price comparison, directional strength, and a "state memory" system.

1. Price Comparison The tool looks back at a user-defined period (defaulting to 70 bars) to compare the current closing price with the closing price from that point in the past. This helps the indicator determine if the price is currently trending significantly higher or lower than it was previously.

2. Directional Strength (ADX Components) To filter out "noisy" price movements, the script utilizes two specific components of the ADX (Average Directional Index) system:

  • Positive Directional Indicator (+DI): Measures the strength of upward movement.
  • Negative Directional Indicator (-DI): Measures the strength of downward movement.

The script compares these two values to see which direction currently has more momentum.

3. Entry Conditions and Visual Markers The indicator places markers on the chart only when specific criteria are met simultaneously:

  • For Upward Signals (Red Arrows): The current price must be higher than the price from the specified period ago, AND the Positive Directional Indicator must be stronger than the Negative one.
  • For Downward Signals (Blue Arrows): The current price must be lower than the price from the specified period ago, AND the Negative Directional Indicator must be stronger than the Positive one.

4. State Tracking (The "LTR" Logic) One of the key features of this script is its ability to prevent "signal clustering." It uses a memory variable to track the most recent signal type. This ensures that if the market is already in an established upward trend, it won't constantly place red arrows on every single bar. It effectively waits for a shift in the primary direction before signaling a new entry, helping to keep the chart clean and highlight only the significant transitions between bullish and bearish movements.

Summary of Behavior

Essentially, this tool acts as a trend-confirmation filter. It waits for the price to establish a clear difference from its past position while ensuring that the underlying momentum (the ADX components) supports that move. By tracking the "last reported" signal, it focuses on identifying new trends rather than highlighting every minor fluctuation within an existing trend.

Indicators Used
Movement directional index
Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
iKarakatica
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
extern int       iPeriod=70;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
int init(){
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,241);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,242);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
   return(0);
}
int start(){
   int limit;
	int counted_bars=IndicatorCounted(); // îïðåäåëèì êîëè÷åñòâî ïðîñ÷èòàíûõ áàðîâ ó èíäèêàòîðà
	limit=Bars-counted_bars; // îïðåäåëÿåì ãðàíèöó äî êîòîðîé ðàññ÷èòûâàåì çíà÷åíèÿ èíäèêàòîðà
	if(limit >Bars-2)limit=Bars-2;
	static int ltr;
	   for(int i=limit-1;i>=0;i--){  
         if(ExtMapBuffer1[i+1]!=0 && ExtMapBuffer1[i+1]!=EMPTY_VALUE)ltr=1;
         if(ExtMapBuffer2[i+1]!=0 && ExtMapBuffer2[i+1]!=EMPTY_VALUE)ltr=2;	
         double pdi=iADX(NULL,0,iPeriod,0,MODE_PLUSDI,i);
         double mdi=iADX(NULL,0,iPeriod,0,MODE_MINUSDI,i);
         ExtMapBuffer1[i]=EMPTY_VALUE; 
         ExtMapBuffer2[i]=EMPTY_VALUE;      
         if(Close[i]>Close[i+iPeriod] && pdi>mdi && ltr!=1)ExtMapBuffer1[i]=Low[i]-Point*5;
         if(Close[i]<Close[i+iPeriod] && pdi<mdi && ltr!=2)ExtMapBuffer2[i]=High[i]+Point*5;
      }      
   return(0);
}

Comments