Juice

This script, titled "Juice," is a custom technical analysis tool designed for the MetaTrader 4 platform. Its primary purpose is to help traders visualize market volatility and momentum by transforming standard price movements into a specialized histogram that oscillates around a zero line.

Core Logic and Functionality

The indicator operates by calculating a specific type of statistical variance known as "Standard Deviation" based on the closing prices of the market. Instead of showing you the price directly, it looks at how much the price is fluctuating over a set timeframe (defined by the "Period" setting).

Here is how the logic flows:

  • Data Transformation: The script takes the current standard deviation and subtracts a specific threshold (the "Level"). This calculation determines whether the current market movement is significant enough to be considered a meaningful trend or just minor noise.
  • The Zero-Line Baseline: By subtracting the level from the deviation, the indicator creates a "neutral" point.
    • If the result is positive, it indicates upward pressure or volatility exceeding your set threshold.
    • If the result is negative, it indicates downward pressure or a decrease in activity below that threshold.
  • Visual Representation (The Histogram): The tool separates these results into two distinct visual colors:
    • Lime Green: This appears when the calculated value is above zero, highlighting positive momentum.
    • Fire Brick: This appears when the calculated value is below zero, highlighting negative momentum.
  • Smart Adjustments: The script contains built-in "intelligence" to automatically adjust its sensitivity based on which currency pair you are trading. For example, it detects specific pairs like USDJPY, EURJPY, and GBPJPY and automatically increases the threshold level to account for their unique price structures. It also includes a secondary adjustment for 5-minute charts to ensure the indicator remains accurate regardless of the timeframe.

Summary for the Trader

In essence, "Juice" acts as a filter. Rather than looking at messy price charts, it provides you with a clean, two-colored histogram. When the bars shift from one color to another, it signals a change in the market's underlying volatility and momentum relative to your chosen sensitivity settings. It is designed to help you see "where the juice is"—identifying the strength of a move while filtering out minor price fluctuations.

Miscellaneous
Implements a curve of type %1
20 Views
0 Downloads
0 Favorites
Juice
//+------------------------------------------------------------------+
//|                                                        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 int Periyod=7;
extern double Level=0.0004;

//---- indicator buffers
double OsMAUpBuffer[];
double OsMADownBuffer[];
double OsMABuffer[];
double MACDBuffer[];
double SignalBuffer[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 2 additional buffers are used for counting.
   IndicatorBuffers(5);
//---- 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);
//---- 3 indicator buffers mapping
   if(!SetIndexBuffer(0,OsMAUpBuffer) &&
      !SetIndexBuffer(1,OsMADownBuffer) &&
      !SetIndexBuffer(2,OsMABuffer) &&
      !SetIndexBuffer(3,MACDBuffer) &&
      !SetIndexBuffer(4,SignalBuffer))
      Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("Juice("+Periyod+","+Level+")");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Average of Oscillator                                     |
//+------------------------------------------------------------------+
int start()
{
//if ( Period != 15)  Alert ("Juice Is Recommended for 15 Min Chart only!!");

 
  if (Symbol()=="USDJPY") Level=0.040;
  if (Symbol()=="EURJPY") Level=0.040;
  if (Symbol()=="GBPJPY") Level=0.040;
   int limit,i;
   int counted_bars=IndicatorCounted();
//---- 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;
if (Level== 0.0004 && Period()==5 ) Level=0.0002;

 
//---- main loop
   for(i=0; i<limit; i++){
      OsMABuffer[i]=iStdDev  (NULL,0,Periyod,MODE_EMA,0,PRICE_CLOSE,i)-(Level);
      
      if(OsMABuffer[i]>0){
         OsMAUpBuffer[i]=OsMABuffer[i];
         OsMADownBuffer[i]=0;
      }else if(OsMABuffer[i]<0){
         OsMADownBuffer[i]=OsMABuffer[i];
         OsMAUpBuffer[i]=0;
      }else{
         OsMAUpBuffer[i]=0;
         OsMADownBuffer[i]=0;
      }
   }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

Comments