i-MaZZSig-T01
Download scriptThis script is designed to identify specific momentum shifts in the financial market by combining two different types of technical analysis: trend structure and moving averages. Instead of showing a continuous line, it places visual markers (arrows) on your chart to highlight precise moments where the price action aligns with specific mathematical conditions.
How the Logic Works
The script operates by analyzing three primary components of the market simultaneously:
1. Trend Structure (ZigZag) The tool uses the "ZigZag" logic to identify the significant peaks and valleys in price movement. By looking at these major turning points, the script filters out minor market noise and focuses only on the broader "skeleton" of the price history.
2. Moving Average Comparison The script calculates two different Exponential Moving Averages (EMA). These are used to determine the current direction of the trend. It compares a "current" average against a "previous" average (shifted slightly back in time) to see if the market momentum is accelerating upward or downward.
3. The Trigger Conditions The script only places a signal on your chart when both the price structure and the moving averages agree perfectly.
- Bullish Signal (Upward Momentum): A marker appears when the ZigZag identifies a new peak, and the moving averages confirm that momentum is curving upward. Specifically, it checks if the current trend point is higher than the previous one and if the shorter-term average is performing stronger than the longer-term average.
- Bearish Signal (Downward Momentum): A marker appears when the ZigZag identifies a new valley, and the moving averages confirm that momentum is curving downward. It checks if the current trend point is lower than the previous one while the moving averages show a declining trajectory.
Summary for the User
Essentially, this tool acts as a "confirmation filter." Rather than showing every price move, it waits for the market's structural peaks/valleys to align with a confirmed shift in moving average momentum. When these two conditions meet, the script places an arrow on your chart to alert you to a potential shift in the market's direction.
//+------------------------------------------------------------------+
//| i-MaZZSig-T01.mq4 |
//| 25.07.2006 Tranlated on MT4 by Êèì Èãîðü Â. aka KimIV |
//| http://www.kimiv.ru |
//+------------------------------------------------------------------+
/*[[
Name := Urovny
Author := HomeSoft Corp.
Link := spiky@transkeino.ru
Separate Window := No
First Color := Gold
First Draw Type := Symbol
First Symbol := 241
Use Second Data := Yes
Second Color := Lime
Second Draw Type := Symbol
Second Symbol := 242
]]*/
#property copyright "HomeSoft Corp."
#property link "spiky@transkeino.ru"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LightBlue
#property indicator_width1 1
#property indicator_color2 Salmon
#property indicator_width2 1
//------- Âíåøíèå ïàðàìåòðû èíäèêòîðà --------------------------------
extern int depth = 20;
extern int deviation = 5;
extern int backstep = 3;
extern int per = 55;
extern int nBars = 1000;
//------- Ãëîáàëüíûå ïåðåìåííûå èíäèêòîðà ----------------------------
double dBuf0[], dBuf1[];
//+------------------------------------------------------------------+
//| Indicator initialization function |
//+------------------------------------------------------------------+
void init() {
SetIndexArrow (0, 241);
SetIndexBuffer (0, dBuf0);
SetIndexEmptyValue(0, EMPTY_VALUE);
SetIndexStyle (0, DRAW_ARROW);
SetIndexArrow (1, 242);
SetIndexBuffer (1, dBuf1);
SetIndexEmptyValue(1, EMPTY_VALUE);
SetIndexStyle (1, DRAW_ARROW);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void start() {
double zz=0, zzold, S2Ma, S0Ma;
int LoopBegin, shift;
if (nBars==0) LoopBegin=Bars-500;
else LoopBegin=nBars;
LoopBegin=MathMin(Bars-500, LoopBegin);
for (shift=LoopBegin; shift>=0; shift--) {
if (zz!=0 && zz!=zzold) zzold=zz;
zz=iCustom(NULL, 0, "ZigZag", depth, deviation, backstep, 0, shift);
S2Ma=iMA(NULL, 0, per, 0, MODE_EMA, PRICE_CLOSE, shift+4);
S0Ma=iMA(NULL, 0, per, 0, MODE_EMA, PRICE_CLOSE, shift);
if (zz!=0 && zzold<zz && zz>S0Ma && zz>S2Ma && S2Ma>S0Ma) {
dBuf1[shift]=zz+5*Point;
}
if (zz!=0 && zzold>zz && zz<S0Ma && zz<S2Ma && S2Ma<S0Ma) {
dBuf0[shift]=zz-5*Point;
}
}
}
//+------------------------------------------------------------------+
Comments