HiFast_LoSlow LoFast_HiSlow LSMA Diverge

Download script
Author: Open Source , Not For Sale
HiFast_LoSlow LoFast_HiSlow LSMA Diverge

This technical indicator is designed to identify specific market trend reversals by detecting "divergences"—situations where the actual price movement contradicts the momentum shown by specialized moving averages. It acts as a visual signaling tool that places markers on your chart to highlight potential entry points where the market might be reaching an exhaustion point.

How the Logic Works

The script operates by constantly comparing four different data streams simultaneously: two "Fast" indicators (which react quickly to recent price changes) and two "Slow" indicators (which represent the broader, long-term trend).

To generate a signal, the tool looks for three specific conditions to be met at the same time:

1. Momentum Crossings The tool monitors whether the fast-moving average has crossed over a slow-moving average in a specific direction. It looks for instances where the "fast" data is moving in one direction while the "slow" data suggests a different primary trend.

2. Price Extremes The indicator doesn't just look at averages; it also tracks the highest highs and lowest lows reached over a specific window of recent price action (specifically looking back 24 bars). It identifies when the current price is pushing into these "extreme" territory zones.

3. The Divergence Signal A signal is triggered only when the momentum and the price action disagree.

  • Bearish Signal (Top Marker): If the fast indicator shows weakness relative to the slow indicator, but the actual market price manages to hit a new high, the script identifies this as a "weak" move. It places a marker above the candle to suggest that despite the high price, the underlying momentum is failing, potentially signaling a downward turn.
  • Bullish Signal (Bottom Marker): Conversely, if the fast indicator shows strength relative to the slow indicator, but the market price manages to drop to a new low, the script identifies this as "hidden" strength. It places a marker below the candle to suggest that despite the low price, the underlying momentum is holding firm, potentially signaling an upward turn.

Visual Output

Rather than drawing continuous lines, this script produces clear visual icons (arrows/markers) on your trading chart. These markers are positioned slightly above or below the price candles based on the current "spread" (the difference between the buying and selling price), ensuring they remain visible and do not clutter the actual price action.

Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
HiFast_LoSlow LoFast_HiSlow LSMA Diverge
//+-------------------------------------------------------------------------+
//|                            HiFast_LoSlow LoFast_HiSlow LSMA Diverge.mq4 |
//|http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ |
//+-------------------------------------------------------------------------+
#property copyright "Open Source , Not For Sale"
#property link      "http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/"

//Thank You , FX Sniper , Robert Hill , MojoFx and whoever it was that originally posted the 21/34 Trend ID settings .

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Coral
#property indicator_color2 White
//---- input parameters

extern int HiFast = 12;
extern int LoSlow = 36;
extern int LoFast = 12;
extern int HiSlow = 36;
extern int BarsToCalculate = 15000;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,234);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,233);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    i,counted_bars=IndicatorCounted();
//---- 
   for (i=counted_bars; i>=0; i--)
      {
      
      double dayhighest = High[Highest(NULL, 0, MODE_HIGH, 24, i)];
      double daylowest  = Low[Lowest(NULL, 0, MODE_LOW, 24, i)];
      double spread = (Ask-Bid);
      double HiF    = iCustom(Symbol(),0,"LSMA_AppliedPrice",HiFast, BarsToCalculate, 2,0,i+1);
      double LoS    = iCustom(Symbol(),0,"LSMA_AppliedPrice",LoSlow, BarsToCalculate, 3,0,i+1);
      double LoF    = iCustom(Symbol(),0,"LSMA_AppliedPrice",LoFast, BarsToCalculate, 3,0,i+1);
      double HiS    = iCustom(Symbol(),0,"LSMA_AppliedPrice",HiSlow, BarsToCalculate, 2,0,i+1);
      
      if ((HiF < LoS) && (High[i] >= dayhighest))
         ExtMapBuffer1[i]=High[i]+(spread*3);
      
      if ((LoF > HiS) && (Low[i] <= daylowest))
         ExtMapBuffer2[i]=Low[i]-(spread*3);
      
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments