This script is designed to provide a quick, automated visual check of the current market momentum based on the relationship between the most recent price candle and the one immediately preceding it. It works by identifying the midpoint of the current price action and comparing it to the boundaries of the previous period.
How the Logic Works:
The tool analyzes three specific scenarios to determine the prevailing "trend" direction:
- Upward Momentum: The script calculates the middle point of the current price bar. If this midpoint is positioned higher than the highest point reached in the previous bar, it identifies the trend as moving upward. A notification will appear on your screen to confirm this bullish movement.
- Downward Momentum: If the midpoint of the current price bar falls below the lowest point of the previous bar, the script recognizes a downward trend. A notification will appear to alert you that the market is currently leaning toward the downside.
- Neutral/Sideways Movement: If the midpoint of the current price falls anywhere within the range (between the high and the low) of the previous bar, the script interprets this as a lack of a clear trend or a "cross" in momentum. It will notify you that there is currently no significant directional bias.
In essence, this tool serves as a simplified visual indicator to help traders quickly categorize the current market state into one of three directions: Up, Down, or Neutral.
//+------------------------------------------------------------------+
//| AnalizTrenda.mq4 |
//| Yuriy Tokman |
//| yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link "yuriytokman@gmail.com"
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
double a=Low[0]+(High[0]-Low[0])/2; //ñåðåäèíà òåêóùåãî áàðà:
if(a>High[1]) //1.íàõîäèòüñÿ âûøå ïèêà ïðåäûäóùåãî áàðà
MessageBox("+ Òðåíä íàïðàâëåí â ââåðõ ","Íàïðàâëåíèå òðåíäà");
if(a<Low[1]) //2.íèæå öåíîâîãî äèàïàçîíà ïðåäûäóùåãî áàðà
MessageBox("- Òðåíä íàïðàâëåí â íèç ","Íàïðàâëåíèå òðåíäà");
if((a<=High[1])&&(a>=Low[1])) //3.âíóòðè öåíîâîãî èíòåðâàëà ïðåäûäóùåãî áàðà
MessageBox("0 Ïåðåêðûòèå ñ íåÿñíûì òðåíäîì ","Íàïðàâëåíèå òðåíäà");
//----
return(0);
}
//+------------------------------------------------------------------+
Comments