test_showNticks_v1
Download scriptThis tool is designed to assist traders by identifying specific momentum shifts in price action using a modified calculation of average prices. Instead of relying on standard closing prices alone, the script focuses on the "Typical Price"—a calculation that averages the high, low, and closing price of a candle—to provide a more balanced view of the market's movement during a specific period.
Core Logic and Functionality
The script operates by scanning historical price data to detect significant changes in this Typical Price. Its primary objective is to highlight moments where the price moves with enough velocity to suggest a potential change in trend.
How it works:
- Price Tracking: The tool continuously calculates the Typical Price for each candle on the chart.
- Momentum Detection: It compares the current Typical Price against the previous one to determine the "change" or velocity of the move.
- Gap Thresholds: The user can define a specific sensitivity level (the Gap Value). The script looks for movements that exceed this predefined threshold in either a positive (upward) or negative (downward) direction.
Visual Signals
The indicator translates these mathematical changes into clear visual cues on your trading chart:
- Downside Signals: When the price drops sharply—specifically, when the change falls below the negative threshold—the script places a red downward arrow. This serves as a visual alert for significant downward momentum.
- Upside Signals: Conversely, when the price rises sharply and exceeds the positive threshold, the script places a white upward arrow. This highlights moments of strong bullish momentum.
- Reference Line: To provide context, the script also plots a continuous line representing the Typical Price flow. This allows you to see the general "path" of the market while using the arrows as specific triggers for high-activity zones.
Summary for the Trader
In essence, this tool filters out minor price fluctuations (market noise) and only alerts you when the price moves significantly enough to potentially signal a trend shift. By visualizing these "gaps" in price movement, it helps traders identify high-momentum entries more objectively.
//+------------------------------------------------------------------+
//| MultiMovingAverage.mq4 |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link "http://www.lightpatch.com"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 White
#property indicator_color3 White
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
// user input
extern double GapVal=0.0005;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
SetIndexStyle(0,DRAW_ARROW);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexArrow(0,234); //down red
SetIndexStyle(1,DRAW_ARROW);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexArrow(1,233); //up white
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2, ExtMapBuffer3);
//SetIndexArrow(2,158); //marker blue
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
int i;
for( i=0; i<Bars; i++ ) ExtMapBuffer1[i]=0;
for( i=0; i<Bars; i++ ) ExtMapBuffer2[i]=0;
for( i=0; i<Bars; i++ ) ExtMapBuffer3[i]=0;
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double curTYP=0;
double oldTYP=0;
double change=0;
int pos=Bars/5;
// Print ("Start SHOW5TICKS with bars=",pos);
while(pos>=0)
{
oldTYP=curTYP;
curTYP=(High[pos]+Low[pos]+Close[pos])/3;
change=curTYP-oldTYP;
if ( change < ( GapVal * (-1) ) )
{
ExtMapBuffer1[pos]=curTYP; //up white
ExtMapBuffer2[pos]=0;
//Print ("would SELL here ",CurTime());
}
if ( change > GapVal )
{
ExtMapBuffer1[pos]=0;
ExtMapBuffer2[pos]=curTYP; //down red
//Print ("would BUY here ",CurTime());
}
// marker for all typicals so they're visual
ExtMapBuffer3[pos]=curTYP; //marker blue
pos--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments