This script functions as a specialized visual tool designed to help traders identify market momentum and volatility trends on a price chart. It operates by transforming standard market data into a dynamic "Heat" indicator, which visualizes the intensity of price movements relative to a specific threshold.
Core Logic and Functionality
The logic behind this tool can be broken down into three main stages:
1. Data Calculation (Volatility Measurement) Instead of simply tracking price, the script calculates the standard deviation of the market—a measure of how much the price is "swinging" or deviating from its average. It focuses on a specific timeframe (defined by the Period setting) and uses an exponential moving average approach to ensure the data remains relevant to current market conditions.
2. Threshold Filtering (The "Level" Logic) The script subtracts a predefined value (the Level) from that volatility measurement. This acts as a filter:
- If the market's movement is stronger than the threshold, it registers as a positive signal.
- If the movement is weaker than the threshold, it results in a neutral or negative output.
3. Visual Representation The script then separates these results into two distinct visual components to make them easy for a trader to read at a glance:
- Positive Momentum: When the market activity exceeds the required level, the indicator displays a specific color (Lime Green). This represents upward momentum or high-activity "heat."
- Negative Momentum: When the activity falls below the threshold, it displays a different color (FireBrick), representing downward pressure or reduced intensity.
Dynamic Adaptability
The script includes automated intelligence to adjust for different currency pairs. It recognizes specific high-value pairs (such as USDJPY, EURJPY, and GBPJPY) and automatically scales its sensitivity levels to ensure the indicator remains accurate regardless of whether you are trading a low-volatility or high-volatility currency.
Summary for the User
In simple terms, this tool tells you when market "heat" is significant enough to matter. By looking at the visual bars, you can quickly see whether the current price action is exceeding your set requirements (Green) or failing to reach them (Red), allowing for a clearer understanding of market direction and strength.
//+------------------------------------------------------------------+
//| 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("Heat("+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