bExperement_v_0_0_2

Download script
Author: Copyright � 2011, Korwin

This tool is designed as a visual market analysis indicator for the MetaTrader platform. Its primary purpose is to track price momentum and "pressure" by identifying specific patterns in candlestick movement, translating these movements into distinct visual markers on your chart.

Core Logic and Behavior

The script operates by analyzing the relationship between a candle's opening and closing prices to determine the initial direction of the market. Here is a breakdown of how it processes information:

1. Directional Identification The logic begins by looking at completed price candles. If a candle closes higher than it opened (a bullish move), the script establishes a "Green" baseline. Conversely, if a candle closes lower than it opened (a bearish move), it establishes a "Red" baseline. These baselines are used to anchor the subsequent visual tracking.

2. Momentum Tracking and Persistence Rather than simply reacting to every price tick, the indicator tracks the continuity of a trend.

  • If the market continues to move in the direction of the established trend (e.g., a green baseline continues to stay below the current closing price), the script adjusts the visual line progressively.
  • This adjustment is calculated based on a specific "divisor" setting, which determines how much the line shifts relative to the total size (the range between high and low) of each candle.

3. Trend Reversal and Reset The indicator is programmed to recognize when price action contradicts the current trend:

  • Trend Break: If the price closes on the opposite side of the current tracking line, the script interprets this as a loss of momentum.
  • Automatic Switch: When this break occurs, the current line is "reset" or terminated. The script immediately generates a new baseline in the opposite color at the high or low of that candle.
  • Recalculation: It then begins tracking the new direction using the same progressive calculation logic.

Summary for the Trader

In essence, this script acts as a dynamic "tension" tracker. Instead of just showing you where the price is, it visualizes how strongly the current trend is holding against opposing pressure. When the line moves progressively, it shows sustained momentum; when the line disappears and reappears in a different color, it signals that the market sentiment has flipped, providing a clear visual cue for potential trend shifts.

Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
bExperement_v_0_0_2
//+------------------------------------------------------------------+
//|                                                  !Experement.mq4 |
//|                                         Copyright © 2011, Korwin |
//|                                             korwin-kor@yandex.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Korwin"
#property link      "korwin-kor@yandex.ru"

#property indicator_chart_window
#property  indicator_buffers 2
#property  indicator_color1  Red
#property  indicator_color2  Green

extern int divisor=6;

double buf0[],buf1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(8);

   SetIndexBuffer(0,buf0); SetIndexStyle(0,DRAW_LINE); SetIndexEmptyValue(0,0);
   SetIndexBuffer(1,buf1); SetIndexStyle(1,DRAW_LINE); SetIndexEmptyValue(1,0);

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit--;

      for(i=limit-1; i>=0; i--)
        {
         if(buf0[i+1]==0 && buf1[i+1]==0)
           {
            if(Close[i+1]>Open[i+1]) buf1[i+1]=Low[i+1];
            if(Close[i+1]<Open[i+1]) buf0[i+1]=High[i+1];
           }
         if(buf0[i+1]>0)
           {
            if(buf0[i+1]>Close[i+1]) buf0[i]=buf0[i+1]-(High[i+1]-Low[i+1])/divisor;
            else
              {
               buf0[i]=0;
               buf1[i+1]=Low[i+1];
               buf1[i]=buf1[i+1]+(High[i+1]-Low[i+1])/divisor;
              }
           }
         if(buf1[i+1]>0)
           {
            if(buf1[i+1]<Close[i+1]) buf1[i]=buf1[i+1]+(High[i+1]-Low[i+1])/divisor;
            else
              {
               buf1[i]=0;
               buf0[i+1]=High[i+1];
               buf0[i]=buf0[i+1]-(High[i+1]-Low[i+1])/divisor;
              }
           }
        }

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

Comments