test5_show5ticks
Download scriptThis tool is designed to provide visual signals on a trading chart by identifying specific momentum shifts in price action. Rather than simply following the price, it focuses on the mathematical relationship between the high, low, and closing prices of each candle to determine the direction of the market.
How the Logic Works
The script operates by calculating a custom average value for every price bar. It takes the highest point, the lowest point, and the closing price of a candle, combines them, and divides by three. This creates a smoothed representation of where the "center of gravity" of the price is moving at any given moment.
The core logic works by comparing this current average against the previous one to determine the speed and direction of the price change:
- Downward Momentum (Sell Signals): If the value drops significantly more than a pre-defined threshold, the script recognizes a strong downward move. It marks this point on your chart with a specific red arrow, highlighting a potential area for selling interest.
- Upward Momentum (Buy Signals): If the value rises significantly more than the pre-defined threshold, the script identifies a strong bullish movement. It marks this point with a white arrow, indicating a potential area for buying interest.
Key Features for Traders
- Threshold Filtering: By requiring a specific minimum change (a set numeric value) before displaying a signal, the tool helps filter out "noise." This means minor price fluctuations that don't represent a real move are ignored, aiming to provide cleaner, more decisive signals.
- Visual Execution: The logic is built to translate complex calculations into immediate visual cues. Instead of requiring you to manually calculate averages, the script automatically places arrows on the chart where the criteria for a momentum shift are met.
- Historical Analysis: The tool scans backward through your price history, allowing you to see where these momentum shifts occurred in the past to better understand how the market reacted during previous trends.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| 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 DeepSkyBlue
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| 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_ARROW);
SetIndexBuffer(2, ExtMapBuffer3);
SetIndexArrow(2,224);
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 < -0.04 )
{
ExtMapBuffer1[pos]=curTYP; //up white
ExtMapBuffer2[pos]=0;
//Print ("would SELL here ",CurTime());
}
if ( change > 0.04 )
{
ExtMapBuffer1[pos]=0;
ExtMapBuffer2[pos]=curTYP; //down red
//Print ("would BUY here ",CurTime());
}
pos--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments