Author: CutzMF
cutz_trend

This indicator is designed to help traders identify potential trend shifts and momentum by analyzing price action in relation to moving averages. It focuses on identifying specific "high-impact" candles that meet a set of technical criteria, marking them on your chart with visual arrows.

Core Logic and Functionality

The script operates by scanning through a specific number of historical bars (defined by the user) and evaluating each one based on three primary conditions:

1. Price Momentum (Bar Body Strength) Before any other signals are considered, the indicator checks the physical size of the candle. It calculates the difference between the opening and closing prices to determine the "body" of the candle. Only bars that exceed a specific predetermined size threshold are eligible for a signal. This ensures that minor price fluctuations are ignored, filtering out "noise" and focusing only on significant price movements.

2. Moving Average Alignment (Trend Confirmation) To ensure that a price move is part of a larger trend rather than an isolated spike, the indicator uses two different moving averages (short-term and long-term) to track the "flow" of the market:

  • Short-Term Tracking: It looks at a very fast average to detect immediate changes in direction.
  • Long-Term Tracking: It looks at a slightly slower average to confirm the broader market direction.

The script compares the current moving averages against their previous values. For a signal to trigger, the current average must be moving in the desired direction (up for bullish signals, down for bearish signals).

3. Signal Generation When both the Price Momentum and the Moving Average Alignment conditions are met simultaneously, the indicator places a visual marker on the chart:

  • Bullish Signal: If the price is moving up strongly enough to meet the body requirements, and the moving averages are trending upward, a green arrow appears at the bottom of the candle.
  • Bearish Signal: If the price is moving down strongly enough to meet the body requirements, and the moving averages are trending downward, a red arrow appears at the top of the candle.

Summary for the User

In simple terms, this tool acts as a filter. It ignores small, insignificant price movements and only highlights moments where a large, decisive candle aligns with the current direction of the market trend. This helps traders visualize areas of high-momentum strength or weakness.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
cutz_trend
//+------------------------------------------------------------------+
//|                                                   cutz_TREND.mq4 |
//|                                                           CutzMF |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "CutzMF"
#property link      ""

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//---- input parameters
extern double    BarBody=0.0094;
extern int CountBars=350;
//---- buffers
double UP[];
double DN[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,167);
   SetIndexBuffer(0,UP);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,167);
   SetIndexBuffer(1,DN);
   SetIndexEmptyValue(1,0.0);
   BarBody=BarBody*BarBody;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    shift,i,counted_bars=IndicatorCounted(); 
   double bar;
   double csma2,psma2,
          csma7,psma7;
//----
   for (shift = CountBars; shift>=0; shift--)  
     {
     bar=Close[shift]-Open[shift];
     bar=(bar)*(bar);
     for (i=0;i<=3;i++)
     {
     psma2=iMA(NULL,0,2,0,i,PRICE_CLOSE,shift+1);//ïðåäûäóùèå
     psma7=iMA(NULL,0,7,0,i,PRICE_CLOSE,shift+1);
     csma2=iMA(NULL,0,2,0,i,PRICE_CLOSE,shift);//íàñòîÿùèå
     csma7=iMA(NULL,0,7,0,i,PRICE_CLOSE,shift);
     
     if ((csma2>psma2)&&(csma7>=psma7)&&(bar>=BarBody)) { UP[shift]=Low[shift]-10*Point; }
     if ((csma2<psma2)&&(csma7<=psma7)&&(bar>=BarBody)) { DN[shift]=High[shift]+10*Point; }
     }
     } 
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments