JuiceLevelsAlert

Download script
JuiceLevelsAlert

The "Juice" indicator is a visual trading tool designed to help traders monitor market volatility and momentum by filtering out background noise. It focuses on identifying specific price movements that exceed a set threshold, making it easier to spot significant shifts in market behavior.

Core Logic and Functionality

1. Volatility Analysis The script works by calculating the standard deviation of price movements over a specific timeframe (defined by the "Period" setting). Standard deviation is a measure of how much prices are fluctuating; by using this as a foundation, the indicator identifies the "energy" or "juice" currently present in the market.

2. Threshold Filtering The tool applies a specific threshold (the "Level") to these volatility readings.

  • If the market activity is below this level, the indicator remains neutral.
  • If the activity pushes beyond this level, the indicator captures that movement as a significant signal.

3. Visual Representation The indicator translates these movements into a separate histogram window:

  • Green Histograms: Represent positive momentum where market activity has exceeded the upper threshold.
  • Red Histograms: Represent negative momentum where market activity has dropped below the lower threshold.
  • Zero Line: When market activity is within the "normal" range (below the threshold), the histogram remains flat.

4. Visual Guidance (Levels) To help traders stay organized, the script can draw horizontal reference lines on the indicator window. These levels are spaced out automatically based on your preferences, providing clear milestones to help you gauge how far the current market momentum is pushing compared to previous highs or lows.

5. Alert System For active trading, the script includes an optional notification system. It can monitor the "Juice" value in real-time and trigger a visual alert and a sound notification whenever the market momentum crosses a specific pip threshold. This allows traders to react quickly to sudden spikes in activity without needing to watch the screen constantly.

Summary for the User

Essentially, this tool acts as a filter: it ignores "quiet" market movements and only highlights significant "bursts" of volatility. By watching the histogram, you can see at a glance whether the current price action is aggressive, retreating, or simply drifting within a normal range.

Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screenIt plays sound alerts
10 Views
0 Downloads
0 Favorites
JuiceLevelsAlert
//+------------------------------------------------------------------+
//|                                                        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