JuiceLevelsAlert_v1

Download script
JuiceLevelsAlert_v1

Technical Overview: Juice Indicator

The Juice indicator is a specialized technical analysis tool designed to help traders visualize market volatility and price momentum. By transforming standard market data into a distinct visual histogram, it allows for a clearer understanding of whether the current price action is trending aggressively or remaining relatively stable.

How the Logic Works

The core functionality of this script relies on calculating the Standard Deviation—a statistical measure used to determine how much a price deviates from its average over a specific period. Here is the step-by-step breakdown of how that data is processed:

  • Volatility Measurement: The tool looks at a user-defined timeframe (the "Period") and calculates the standard deviation using an Exponential Moving Average (EMA) calculation. This focuses on recent price changes to provide a current snapshot of market "energy."
  • The Threshold Filter: The script then applies a specific "Level" or threshold to that volatility measurement. Think of this as a filter: if the market movement is below a certain strength, the indicator remains neutral.
  • Visual Representation (Histogram): Once the calculated value exceeds the established threshold, the indicator reacts visually:
    • Positive Momentum: If the activity is significantly above the level, it creates an upward-moving histogram (traditionally displayed in Green).
    • Negative Momentum: If the activity falls significantly below the level, it creates a downward-moving histogram (traditionally displayed in Red).
  • Dynamic Level Lines: The tool automatically plots a series of reference lines on the display. These lines act as visual benchmarks, helping traders see exactly how much "juice" or momentum is required to trigger a significant move compared to previous price action.

Key Features for Traders

  • Alert System: The script can be configured to monitor these levels in real-time. If the market volatility exceeds a specific point threshold (customizable by the user), the software can trigger an audible sound and a pop-up alert on the trading platform.
  • Visual Clarity: By isolating only the significant movements and filtering out "market noise," the indicator provides a cleaner view of price trends, making it easier to identify when a move has actual strength behind it.
  • Customizable Sensitivity: Users can adjust the period (how much history to look at), the level (the intensity required to trigger a signal), and the visual layout of the reference lines to suit different trading styles or asset classes.
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screenIt plays sound alerts
13 Views
0 Downloads
0 Favorites
JuiceLevelsAlert_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                        Juice.mq4 |
//|                                                          Perky_z |
//|                              http://fxovereasy.atspace.com/index |
//+------------------------------------------------------------------+
#property  copyright "perky"
#property  link      "http://fxovereasy.atspace.com/index"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  LimeGreen
#property  indicator_color2  FireBrick
//---- indicator parameters
extern bool DoAlerts = false;
extern int AlertFromPips = 5;
extern int Periyod=7;
extern double Level=5;
extern bool JuiceLevelsVisible = true;
extern int JuiceStartPips = 5;
extern int JuiceStepPips = 5;
extern int JuiceLevelsNumber = 4;
extern color JuiceLevelColor = Silver;

//---- indicator buffers
double OsMAUpBuffer[];
double OsMADownBuffer[];
double OsMAValue;
double currentJuiceLevel;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 2 additional buffers are used for counting.
   IndicatorBuffers(2);
//---- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,1);
   SetIndexDrawBegin(0,Level);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2);
//---- 2 indicator buffers mapping
   if(!SetIndexBuffer(0,OsMAUpBuffer) &&
      !SetIndexBuffer(1,OsMADownBuffer))
      Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("Juice("+Periyod+","+Level+")");

//---- initialization done
   return(0);
  }

int SetLevelLines()
{
   string levelLabel;
   if(JuiceLevelsVisible)
   {
      SetLevelStyle(STYLE_DASH,1,JuiceLevelColor);
      for(int i=1; i<= JuiceLevelsNumber; i++)
      {
         
         currentJuiceLevel = (JuiceStartPips + (i-1)*JuiceStepPips)*Point;
         SetLevelValue(i,currentJuiceLevel);
         levelLabel = "Level "+i+": "+currentJuiceLevel;
         SetIndexLabel(i,levelLabel);
      }
   }else
   {
      for(i=1; i<= JuiceLevelsNumber; i++)
      {
         
         SetLevelValue(i,0.0);
         
      }
   }
}

//+------------------------------------------------------------------+
//| Moving Average of Oscillator                                     |
//+------------------------------------------------------------------+
int start()
{
//if ( Period != 15)  Alert ("Juice Is Recommended for 15 Min Chart only!!");
   int limit,i;
   int counted_bars=IndicatorCounted();
   double Juice;
   bool TurnOnAlert = true;
   
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   Level = Level*Point;
   
  if (Period()==5 ) Level=Level/2;
  
  SetLevelLines();
 
//---- main loop
   for(i=0; i<limit; i++)
   {
      Juice=iStdDev  (NULL,0,Periyod,MODE_EMA,0,PRICE_CLOSE,i)-Level;
      if(Juice>0){
         OsMAUpBuffer[i]=Juice;
         OsMADownBuffer[i]=0;
      }else if(Juice<0){
         OsMADownBuffer[i]=Juice;
         OsMAUpBuffer[i]=0;
      }else{
         OsMAUpBuffer[i]=0;
         OsMADownBuffer[i]=0;
      }
   }
   
   if (DoAlerts)
   {
      if (Juice > AlertFromPips*Point && Period() == 5)
      {
         if (TurnOnAlert)
         {
            Alert("Juice above ",AlertFromPips*Point," for ", Symbol());
            PlaySound("Tick.wav");
            TurnOnAlert = false;
         }
      }
      else
      {
         TurnOnAlert = true;
      }
   }
      
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

Comments