MT4-Psychological_v2

Download script
Author: Copyright � 2007, Bruce Hellstrom (brucehvn)

This tool is a specialized visual aid designed to help traders gauge market sentiment by analyzing historical price trends over a specific timeframe. Rather than focusing on complex mathematical derivatives, it operates on the principle of "market psychology"—essentially tracking whether the prevailing momentum in the market is bullish (upward) or bearish (downward).

How It Works

The indicator works by looking back at a set number of recent candles (defined by a user-adjustable period, defaulting to 25) and evaluating the direction of price movement for each one.

  1. Trend Tracking: The script scans the history of closing prices. For every instance where a previous candle closed higher than the one before it, the tool registers a positive "point" for upward momentum.
  2. Momentum Calculation: It then takes these points and calculates the percentage of time the market spent moving in an upward direction compared to the total period being analyzed.
  3. Visual Representation: This result is converted into a percentage value, which is plotted as a line on your chart.

Key Features and Interpretation

  • Sentiment Gauges: The indicator features three specific horizontal reference levels (25%, 50%, and 75%). These serve as visual anchors to help you identify where the market sentiment stands.
  • Balanced Perspective: By converting price action into a percentage, the tool allows you to see how "overextended" a trend might be. For example, if the indicator is near the top of its range, it suggests that the vast majority of recent price action has been positive, potentially indicating an overbought sentiment.
  • Customizable Sensitivity: You can adjust the "Lookback Period" to change how much history the tool considers. A shorter period makes the indicator more sensitive to immediate price changes, while a longer period provides a broader view of the overall market trend.

In short, this script translates raw price data into a psychological map, helping you visualize whether the current market "mood" is leaning heavily toward the buyers or the sellers.

Miscellaneous
Implements a curve of type %1
4 Views
0 Downloads
0 Favorites
MT4-Psychological_v2
//+------------------------------------------------------------------+
//|                                                                  |
//|               Psychological Indicator (Ported from FXAccucharts) |
//|                                                      Version 1.0 |
//|                     Copyright © 2007, Bruce Hellstrom (brucehvn) |
//|                                              bhweb@speakeasy.net |
//|                                         http://www.metaquotes.ru |
//+------------------------------------------------------------------+
//+--------------------------------------------------------------------------------+
//|  This indicator is ported from the FXAccuCharts platform to MT4. The formula   |
//|  used here has been tested on FXAccuCharts to insure it displays the same as   |
//|  their default psychological indicator.                                        |
//|                                                                                |
//| Input Parameters:                                                              |
//|  PsychPeriod - Lookback periods for the indicator (25 default)                 |
//|                                                                                |
//| Revision History                                                               |
//|    Version 1.0                                                                 |
//|    * Initial Revision                                                          |
//+--------------------------------------------------------------------------------+
#property copyright "Copyright © 2007, Bruce Hellstrom (brucehvn)"
#property link      "http: //www.metaquotes.net/"
//----
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
#property indicator_style1 STYLE_SOLID
//----
#property indicator_level1 50.0
#property indicator_level2 75.0
#property indicator_level3 25.0
#property indicator_levelcolor Silver
#property indicator_levelwidth 1
#property indicator_levelstyle STYLE_DOT
#define INDICATOR_VERSION "v1.0"
// Input Parameters
extern int PsychPeriod=25;
// Buffers
double PsychBuffer[];
// Other Variables
string ShortName;
int CountBuf[];
// Custom indicator initialization function
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(1);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
   SetIndexBuffer(0,PsychBuffer);
   SetIndexDrawBegin(0,PsychPeriod);
   ArraySetAsSeries(CountBuf,true);
   ShortName="Psychological-"+INDICATOR_VERSION+"("+PsychPeriod+")";
   IndicatorShortName(ShortName);
   SetIndexLabel(0,ShortName);
   Print(ShortName);
   Print("Copyright (c) 2007 - Bruce Hellstrom, bhweb@speakeasy.net");
//----
   return(0);
  }
// Custom indicator deinitialization function
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
// Indicator Logic run on every tick
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(Bars<PsychPeriod)
     {
      Print("not enough bars");
      return(0);
     }
   if(counted_bars==0) limit-=(1+PsychPeriod+1);

// Resize the non-buffer array if necessary
   if(ArraySize(CountBuf)!=ArraySize(PsychBuffer))
     {
      ArraySetAsSeries(CountBuf,false);
      ArrayResize(CountBuf,ArraySize(PsychBuffer));
      ArraySetAsSeries(CountBuf,true);
     }

   for(int ictr=0; ictr<limit; ictr++)
     {
      int Count=0;
      int endctr=ictr+1+PsychPeriod;
      for(int jctr=ictr+1; jctr<endctr; jctr++)
        {
         if(Close[jctr]>Close[jctr+1])
           {
            Count++;
           }
        }
      if(Close[ictr]>Close[ictr+1])
        {
         Count++;
        }
      if(Close[ictr+PsychPeriod]>Close[ictr+PsychPeriod+1])
        {
         Count--;
        }
      double dCount=Count;
      PsychBuffer[ictr]=(dCount/PsychPeriod) *100.0;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments