HiFast_LoSlow LoFast_HiSlow LSMA Diverge_v1
Download scriptThis technical indicator is designed to identify specific price action signals by analyzing the relationship between trend momentum and significant price extremes. It works by monitoring four different moving averages simultaneously to detect "divergences"—moments where the current price movement contradicts the underlying trend.
Core Logic Overview
The tool filters market noise by looking for two distinct conditions: one for potential selling opportunities (Bearish) and one for potential buying opportunities (Bullish).
1. Trend Momentum Analysis The script utilizes four different data points based on a specialized smoothed moving average. It tracks "Fast" and "Slow" versions of these averages to gauge the strength and direction of the market. By comparing these values, the system can determine if the market is showing signs of exhaustion or a shift in sentiment.
2. Price Extreme Identification Instead of reacting to every minor price fluctuation, the logic focuses on significant historical highs and lows within a 24-period window. It specifically looks for instances where the price reaches these local peaks or troughs.
Signal Generation
The indicator places visual markers on your chart only when two specific conditions are met at the same time:
- Bearish Signals (Sell Opportunities): The tool looks for a situation where the "Fast" trend value drops below the "Slow" trend value, while the current price simultaneously hits a recent high. This combination suggests that despite the price reaching a peak, the underlying momentum is weakening, potentially signaling a reversal downward.
- Bullish Signals (Buy Opportunities): Conversely, it looks for instances where the "Fast" trend value rises above the "Slow" trend value while the price hits a recent low. This suggests that even though the price is at a bottom, the momentum is beginning to turn upward, potentially signaling a reversal to the upside.
Visual Execution
When these specific conditions are met, the script automatically places an arrow on the chart:
- An arrow appearing above the high of a candle indicates a bearish alert.
- An arrow appearing below the low of a candle indicates a bullish alert.
To ensure accuracy and prevent visual clutter, the indicators are offset slightly from the candles using the current market "spread" (the difference between the buy and sell price), ensuring that the signals remain clearly visible and do not overlap with the price action.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+-------------------------------------------------------------------------+
//| 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