test_5F3expert

Download script
Author: Ron T
test_5F3expert

This custom indicator is designed to provide visual cues on a trading chart by identifying specific shifts in price momentum. It functions by analyzing the relationship between current and past price movements to signal potential trend changes.

Core Logic and Functionality

The tool operates by calculating a customized "average" price point for each candle on your chart. Instead of relying solely on the closing price, it blends four components—the high, the low, and twice the closing price—to create a more balanced representation of where the price actually moved during that specific period.

The indicator then compares these calculated points across three consecutive candles to determine the direction of the market:

  • Downward Momentum Detection: The script monitors if the calculated price points are consistently decreasing over three periods. If it detects this steady decline, it triggers a visual signal (a red downward arrow) on the chart. This indicates that the price momentum is moving lower.
  • Upward Momentum Detection: Conversely, the script looks for instances where the price points are consistently increasing over three periods. When this upward movement is confirmed, it places a visual signal (a white upward arrow) on the chart, suggesting a bullish trend.

Key Features

  • Visual Signals: The primary purpose of this script is to translate raw price data into easy-to-read arrows. This allows traders to see potential trend movements at a glance without manually calculating historical price changes.
  • Consistent Offsets: To ensure the visual markers do not overlap directly with the candles (which would make the chart messy), the indicator automatically places the arrows at a slight, predefined distance from the actual price point.
  • Historical Analysis: The script automatically scans through your entire chart history, ensuring that all previous signals are plotted accurately from the beginning of the data set to the current moment.

By identifying these sequential shifts in price positioning, the indicator serves as a visual guide for traders looking to recognize moving trends in real-time.

Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
test_5F3expert
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//| test.mq4                                                         |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link      "http://www.lightpatch.com"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 White
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 White

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];

// User Input
extern double Gap_Size=0.0030;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|

int init()
  {

   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexArrow(0,233); //up red
   
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexArrow(1,234); //down white

   SetIndexStyle(2,DRAW_ARROW);
   SetIndexBuffer(2, ExtMapBuffer3);
   SetIndexArrow(2,168);  // Red

   SetIndexStyle(3,DRAW_ARROW);
   SetIndexBuffer(3, ExtMapBuffer4);
   SetIndexArrow(3,168);  // White

   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;
   for( i=0; i<Bars; i++ ) ExtMapBuffer4[i]=0;

   return(0);
  }


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double oTYP0=0, oTYP1=0, oTYP2=0, oTYP3=0, oTYP4=0, oTYP5=0;

   int pos=Bars;
      
   while(pos>=0)
     {


      oTYP0=(High[pos+0]+Low[pos+0]+Close[pos+0]+Close[pos+0])/4;
      oTYP1=(High[pos+1]+Low[pos+1]+Close[pos+1]+Close[pos+1])/4;
      oTYP2=(High[pos+2]+Low[pos+2]+Close[pos+2]+Close[pos+2])/4;

      // down trend
      if(oTYP2 > oTYP1 && oTYP1 > oTYP0)
        {
         ExtMapBuffer1[pos]=0;
         ExtMapBuffer2[pos]=oTYP0-0.0010;  //down red
        }
      
      // up trend
      if(oTYP2 < oTYP1 && oTYP1 < oTYP0)
        {
         ExtMapBuffer1[pos]=oTYP0+0.0010;  //up white
         ExtMapBuffer2[pos]=0;
        }
 	   pos--;
     }

   return(0);
  }
//+------------------------------------------------------------------+

Comments