DSS Bressert

Download script
Author: Copyright � 2008, MetaQuotes Software Corp.
DSS Bressert

This indicator is designed to provide a visual representation of market momentum and price positioning by processing two distinct layers of data. It operates on a scale of 0 to 100, creating a secondary window that helps traders identify where the current price sits in relation to recent high and low points.

Core Logic Overview

The script functions by calculating two primary components: the MIT (Momentum Index) and the DSS (Double Stochastic Oscillator). Instead of simply showing raw price movements, it translates those movements into a percentage-based range to make the data easier to interpret.

1. The Momentum Index (MIT)

The first stage of the logic looks at the most recent price candles over a specific timeframe (defined by the Stochastic period). It identifies the highest peak and the lowest trough within that window. By measuring where the current closing price sits between those two extremes, it calculates a "momentum" percentage.

To prevent the data from jumping around too erratically, the script applies a smoothing technique. This ensures that the resulting line moves fluidly, filtering out minor market "noise" while still capturing the primary trend of the price action.

2. The Double Stochastic Oscillator (DSS)

The second stage takes the smoothed momentum data from the first step and subjects it to a second round of the same calculation. Essentially, it treats the "momentum line" as if it were the price itself. It looks for the highs and lows within that momentum data to create a secondary, even more refined indicator.

This "double" processing helps to isolate the underlying trend. Because it is calculated based on a smoothed momentum value rather than the raw price, it provides a clearer picture of whether the market's strength is accelerating, slowing down, or reaching an exhaustion point.

Key Visual Features

  • Smoothing: The tool uses a smoothing coefficient based on a user-defined period. This allows for a balance between responsiveness (how fast it reacts to new info) and stability (how much it ignores random price flickers).
  • Overbought/Oversold Levels: The indicator includes preset visual levels (20 and 80). These serve as guides to help identify potential extremes in the market—where the price might be considered overextended in one direction or undervalued in another.
  • Two-Line Output: By plotting both the primary momentum and the double stochastic lines, the tool allows for a comparison between immediate price movement and the broader underlying trend.
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
DSS Bressert
//+------------------------------------------------------------------+
//|                                                 DSS Bressert.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 DarkBlue
#property indicator_level1 20
#property indicator_level2 80

//---- input parameters
extern int       EMA_period=8;
extern int       Stochastic_period=13;
//---- buffers
double DssBuffer[];
double MitBuffer[];

double smooth_coefficient;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,DssBuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,MitBuffer);
   
   SetIndexEmptyValue(0, 0.0);
   SetIndexLabel(0, "DSS");
   SetIndexEmptyValue(1, 0.0);
   SetIndexLabel(1, "MIT");

   IndicatorShortName ("DSS("+EMA_period+","+Stochastic_period+")");

   smooth_coefficient = 2.0 / (1.0 + EMA_period);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i, limit, counted_bars=IndicatorCounted();
//----
   if (counted_bars == 0)   limit = Bars - Stochastic_period;
   if (counted_bars > 0)   limit = Bars - counted_bars;
   
   double HighRange, LowRange;
   double delta, MIT;
   for (i = limit; i >= 0; i--)
      {
      HighRange = High[iHighest(NULL,0,MODE_HIGH,Stochastic_period,i)];
      LowRange = Low[iLowest(NULL,0,MODE_LOW,Stochastic_period,i)];
      delta = Close[i] - LowRange;
      MIT = delta/(HighRange - LowRange)*100.0;
      MitBuffer[i] = smooth_coefficient * (MIT - MitBuffer[i+1]) + MitBuffer[i+1];
      }

   double DSS;
   for (i = limit; i >= 0; i--)
      {
      HighRange = MitBuffer[ArrayMaximum(MitBuffer, Stochastic_period, i)];
      LowRange = MitBuffer[ArrayMinimum(MitBuffer, Stochastic_period, i)];
      delta = MitBuffer[i] - LowRange;
      DSS = delta/(HighRange - LowRange)*100.0;
      DssBuffer[i] = smooth_coefficient * (DSS - DssBuffer[i+1]) + DssBuffer[i+1];
      }
      
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments