Robby Dss Bressert Colored with alertv1.1[mtf]

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

This tool is a technical analysis indicator designed to help traders identify price momentum and potential trend reversals by calculating the relative position of the market within specific price ranges. It operates by smoothing out market "noise" to provide a clearer picture of where the current price sits compared to recent highs and lows.

Core Logic and Methodology

The script functions through a multi-layered calculation process:

1. Multi-Timeframe Data Integration One of the primary features of this logic is its ability to look at different "time horizons." While you may be viewing a small timeframe (like 1 minute), the script can be configured to pull data from much larger periods (such as Daily or Weekly). This allows traders to see how broader market trends are influencing the current price action.

2. The Two-Step Smoothing Process The indicator doesn't just look at the raw price; it processes the data in two distinct stages to ensure stability:

  • Initial Range Calculation: It first identifies the highest and lowest prices over a specific period. It then calculates where the current price sits within that range as a percentage. This value is then "smoothed" (averaged) to prevent erratic jumps caused by sudden, temporary price spikes.
  • Secondary Momentum Smoothing: The script takes the results of that first calculation and repeats the process—finding the highs and lows of those smoothed values. This creates a secondary layer of filtering, resulting in a much more stable and "curved" visual representation of market momentum.

3. Trend Identification (The Colored Signals) The tool translates these complex mathematical calculations into simple visual cues:

  • Upward Momentum: When the smoothed value begins to rise compared to the previous data point, it signals upward pressure. The script tracks this and highlights it as a "DSS Up" signal.
  • Downward Momentum: Conversely, when the value begins to drop, it identifies downward pressure and marks it as a "DSS Down" signal.

4. Real-Time Alerts To ensure traders don't have to watch the screen constantly, the script includes an automated notification system. It monitors for specific "crossovers"—moments where the momentum shifts from up to down (or vice versa). When these transitions occur, the tool triggers a pop-up alert on the trading platform, notifying the user of the change in direction immediately.

Summary for the User

In essence, this script acts as a sophisticated "momentum filter." Instead of reacting to every tiny movement in price, it looks at the "big picture" by calculating where the price is currently sitting relative to recent history and smoothing out the wobbles. It tells you when the momentum is shifting significantly enough to warrant attention, providing both a visual map on your chart and an instant notification when a trend change is detected.

Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
14 Views
0 Downloads
0 Favorites
Robby Dss Bressert Colored with alertv1.1[mtf]
//+------------------------------------------------------------------+
//|                                   Robby DSS Bressert Colored.mq4 |
//|                                                   Jaanus Jantson |
//|                          http://fx.jantson.ee; jaanus@jantson.ee |
//|                      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 3
#property indicator_color1 OrangeRed
#property indicator_width1 3
#property indicator_color2 Blue
#property indicator_width2 2
#property indicator_color3 Red
#property indicator_width3 2
#property indicator_level1 20
#property indicator_level2 80

extern bool      AlertOn               = true;
extern int       EMA_period            = 8;
extern int       Stochastic_period     = 13;
extern int       TimeFrame             = 0;
extern string    note_TimeFrames_      = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-currentTF";


double DssBuffer[];
double MitBuffer[];
double DssBuffer_UP[];
double DssBuffer_DW[];


double smooth_coefficient;
datetime alertonce = 0;
string IndicatorFileName;

int init()
{
   string short_name;
   IndicatorBuffers(4);
   SetIndexBuffer(0,DssBuffer);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(1,DssBuffer_UP);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,159);
   SetIndexBuffer(2,DssBuffer_DW);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,159);

   SetIndexBuffer(3,MitBuffer);
   
   SetIndexEmptyValue(0, 0.0);
   SetIndexLabel(0, "DSS");
   SetIndexEmptyValue(1, 0.0);
   SetIndexLabel(1, "DSS Up");
   SetIndexEmptyValue(2, 0.0);
   SetIndexLabel(2, "DSS Down");
      switch(TimeFrame)
   {
      case 1: string TimeFrameStr = "M1" ;  break;
      case 5     :   TimeFrameStr = "M5" ;  break;
      case 15    :   TimeFrameStr = "M15";  break;
      case 30    :   TimeFrameStr = "M30";  break;
      case 60    :   TimeFrameStr = "H1" ;  break;
      case 240   :   TimeFrameStr = "H4" ;  break;
      case 1440  :   TimeFrameStr = "D1" ;  break;
      case 10080 :   TimeFrameStr = "W1" ;  break;
      case 43200 :   TimeFrameStr = "MN1";  break;
      default :      TimeFrameStr = "TF0";
   }

   TimeFrame         = MathMax(TimeFrame,Period());
   IndicatorFileName = WindowExpertName();
   short_name=("DSS("+EMA_period+","+Stochastic_period+","+TimeFrameStr+")") ;
   IndicatorShortName(short_name);

   smooth_coefficient = 2.0 / (1.0 + EMA_period);
   return(0);
}


int start()
{
   int i, limit, counted_bars=IndicatorCounted(), Bar_OK;
   if (counted_bars == 0)   limit = Bars - Stochastic_period;
   if (counted_bars > 0)   limit = Bars - counted_bars;
   
   if (TimeFrame != Period())
   {
      datetime TimeArray[];
         limit = MathMax(limit,TimeFrame/Period());
         ArrayCopySeries(TimeArray ,MODE_TIME ,NULL,TimeFrame);


         for(i=0,int y=0; i<limit; i++)
         {
            if(Time[i]<TimeArray[y]) y++;
            
     DssBuffer[i]    = iCustom(NULL,TimeFrame,IndicatorFileName,AlertOn,EMA_period,Stochastic_period,0,i);
     DssBuffer_UP[i] = iCustom(NULL,TimeFrame,IndicatorFileName,AlertOn,EMA_period,Stochastic_period,1,i); 
     DssBuffer_DW[i] = iCustom(NULL,TimeFrame,IndicatorFileName,AlertOn,EMA_period,Stochastic_period,2,i);
     MitBuffer[i]    = iCustom(NULL,TimeFrame,IndicatorFileName,AlertOn,EMA_period,Stochastic_period,3,i); 
     
    }
   return(0);         
  }       
    
   
   double HighRange, LowRange;
   double delta, MIT;
   for (i = limit; i >= 0; i--)
   {
      HighRange = High[iHighest(NULL,TimeFrame,MODE_HIGH,Stochastic_period,i)];
      LowRange = Low[iLowest(NULL,TimeFrame,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];
   }

   for (i = limit; i >= 0; i--)
   {
      //DssBuffer_UP[i]=EMPTY_VALUE;
      //DssBuffer_DW[i]=EMPTY_VALUE;
      Bar_OK=0;
      
      if(DssBuffer[i]>DssBuffer[i+1])
      {
         DssBuffer_UP[i]=DssBuffer[i];
         Bar_OK=1;
         DssBuffer_DW[i] = 0.0;
      }

      if(DssBuffer[i]<DssBuffer[i+1])
      {
         DssBuffer_DW[i]=DssBuffer[i];
         Bar_OK=1;
         DssBuffer_UP[i] = 0.0;
      }

      if(Bar_OK==0)
      {
         DssBuffer_UP[i]=DssBuffer_UP[i+1];
         DssBuffer_DW[i]=DssBuffer_DW[i+1];
      }   
   }

   if ( AlertOn && alertonce != Time[0] )
      {
         if ( DssBuffer_DW[1] != 0.0 && DssBuffer_DW[2] == 0.0 )
            {
               Alert(Symbol(), " DSS DOWN ON ", Period(), "Minute  AT ", Close[0]  );
               alertonce = Time[0];
            }
         if ( DssBuffer_UP[1] != 0.0 && DssBuffer_UP[2] == 0.0 )
            {
               Alert(Symbol(), " DSS UP ON ", Period(), "Minute  AT ", Close[0] );
               alertonce = Time[0];
            }     
      }
   
   return(0);
}

Comments