Jay_Digital Parabolic Spy
Download scriptThe Jay_Digital Parabolic Spy is a specialized trading tool designed to provide traders with a multi-timeframe perspective on market trends and price volatility. Unlike standard indicators that only show data for the current chart you are viewing, this script aggregates information from four different timeframes simultaneously (M15, M30, H1, and H4), allowing for a more comprehensive analysis of market momentum at a single glance.
Core Functionality and Logic
Multi-Timeframe Monitoring The primary logic of the script revolves around a "monitoring loop." It scans four distinct timeframes to pull real-time data. By displaying this information in one window, it helps traders identify if a trend is consistent across short-term and long-term intervals or if there are conflicting signals between different periods.
Parabolic SAR Analysis The script utilizes the Parabolic Stop and Reverse (SAR) logic as its primary engine. It calculates whether the current market price is above or below the projected "pivot" point of the SAR:
- Bullish Signal: When the price closes above the SAR value, the script identifies a potential "Buy" trend.
- Bearish Signal: When the price closes below the SAR value, the script identifies a potential "Sell" trend.
Dynamic Data Visualization To make this data easy to read, the script automatically generates a visual dashboard:
- Trend Direction: It uses distinct colors (Chartreuse for Buys and Red for Sells) and specific symbols to indicate the current market direction for each timeframe.
- Pip Difference: It calculates the exact distance between the current price and the SAR value. This helps traders understand the "strength" of the current move—the larger the gap, the more significant the movement from the pivot point.
- Swing Volatility: The script tracks the high and low prices for each timeframe to calculate the "Swing," which represents the total price range covered in that specific period.
Summary for the User
Instead of manually switching between different tabs to see what is happening on the 15-minute chart versus the 4-hour chart, this tool creates a consolidated dashboard. It tells you instantly where the price is relative to the trend (Buy/Sell), how far it has moved from that trend line (PipDiff), and the total volatility of the current move (Swing) across all major timeframes simultaneously.
//+------------------------------------------------------------------+
//| Jay_Digital Parabolic Spy.mq4 |
//| Oje Uadia |
//| moneyinthesack@yahoo.com |
//+------------------------------------------------------------------+
#property copyright "Oje Uadia"
#property link "moneyinthesack@yahoo.com"
#property indicator_separate_window
//---- input parameters
extern double par_step=0.02;
extern double par_max=0.2;
extern color buycolour=Chartreuse;
extern color sellcolour=Red;
int Buy = 233;
int Sell = 234;
int Wait = 54;
int myspace;
string shortname = "Jay_Digital Parabolic Spy v.1";
string timeframes []={"M15","M30","H1","H4"};
int times[]={15,30,60,240};
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if (Year()>2009)
{
Alert("this indicator has expired. pls call 08061228696 for renewal");
return(0);
}
IndicatorShortName(shortname);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
if (Year()>2009)
{
Alert("this indicator has expired. pls call 08061228696 for renewal");
return(0);
}
int counted_bars=IndicatorCounted();
myspace=WindowFind(shortname);
//----------------------------------------------------------------------------------------------------------------------
//---- to do the drawings once only
//----------------------------------------------------------------------------------------------------------------------
static bool alreadydrawn= false;
if (alreadydrawn==false)
{
//------------------------------------------------------------------------------
// create position and pipDiff and swing
//------------------------------------------------------------------------------
ObjectCreate("Position",OBJ_LABEL,myspace,0,0,0,0,0,0);
ObjectSet("Position",OBJPROP_XDISTANCE,10);
ObjectSet("Position",OBJPROP_YDISTANCE,25);
ObjectSetText("Position","Position",12,"Times New Roman",White);
//----------------------------------------------------------------------------------
ObjectCreate("pipDiff",OBJ_LABEL,myspace,0,0,0,0,0,0);
ObjectSet ("pipDiff",OBJPROP_XDISTANCE,10);
ObjectSet("pipDiff",OBJPROP_YDISTANCE,43);
ObjectSetText("pipDiff","pipDiff",12,"Times New Roman",White);
//---------------------------------------------------------------------------------
ObjectCreate("Swing",OBJ_LABEL,myspace,0,0,0,0,0,0);
ObjectSet("Swing",OBJPROP_XDISTANCE,10);
ObjectSet("Swing",OBJPROP_YDISTANCE,61);
ObjectSetText("Swing","SwinG",12,"Times New Roman",White);
//----------------------------------------------------------------------------------------------------
// cycle for timeframes
//---------------------------------------------------------------------------------------------------
for (int x=0;x<4;x++)
{
ObjectCreate("timename"+x,OBJ_LABEL,myspace,0,0,0,0,0,0);
ObjectSet("timename"+x,OBJPROP_XDISTANCE,(x*80)+100);
ObjectSet("timename"+x,OBJPROP_YDISTANCE,14);
ObjectSetText("timename"+x,timeframes[x],7,"Times New Roman",White);
}// end of timefram creating loop
//-------------------------------------------------------------------------------------------------------
// activate the position symbols
//-------------------------------------------------------------------------------------------------------
for ( x=0;x<4;x++)
{
ObjectCreate("pozsignals"+x,OBJ_LABEL,myspace,0,0,0,0,0,0);
ObjectSet("pozsignals"+x,OBJPROP_XDISTANCE,(x*80)+100);
ObjectSet("pozsignals"+x,OBJPROP_YDISTANCE,30);
ObjectSetText("pozsignals"+x,CharToStr(Wait),10,"Wingdings",Yellow);
}// end of position symbols
//---------------------------------------------------------------------------------------------------
// create the pipdiff symbols
//--------------------------------------------------------------------------------------------------
for ( x=0;x<4;x++)
{
ObjectCreate("diffsignals"+x,OBJ_LABEL,myspace,0,0,0,0,0,0);
ObjectSet("diffsignals"+x,OBJPROP_XDISTANCE,(x*80)+100);
ObjectSet("diffsignals"+x,OBJPROP_YDISTANCE,46);
ObjectSetText("diffsignals"+x,CharToStr(Wait),10,"Wingdings",Yellow);
//------------------------------------------------------------------------------------------------------
// create swing symbols
//-----------------------------------------------------------------------------------------------------
ObjectCreate("swingn"+x,OBJ_LABEL,myspace,0,0,0,0,0,0);
ObjectSet("swingn"+x,OBJPROP_XDISTANCE,(x*80)+100);
ObjectSet("swingn"+x,OBJPROP_YDISTANCE,61);
ObjectSetText("swingn"+x,DoubleToStr(iHigh(Symbol(),times[x],0)-iLow(Symbol(),times[x],0),Digits),10,"Times New Roman",Yellow);
}// end of pipDiff symbols
alreadydrawn=true;
}// end of the once only code
//----------------------------------------------------------------------------------------------------------
// calculate the sar values and assign appropriately
//----------------------------------------------------------------------------------------------------------
for (x=0;x<4;x++)
{
double sar = iSAR(Symbol(),times[x],par_step,par_max,0);
double sweetsar = NormalizeDouble(sar,2);
double price = NormalizeDouble(iClose(Symbol(),times[x],0),2);
if (sar>iClose(Symbol(),times[x],0))
{
ObjectSetText("pozsignals"+x,CharToStr(Sell),10,"Wingdings",sellcolour);
ObjectSetText("diffsignals"+x,DoubleToStr(sar-iClose(Symbol(),times[x],0),Digits),10,"Times New Roman",sellcolour);
//ObjectSetText("diffsignals"+x,"" + sweetsar - price,10,"Times New Roman",sellcolour);
}//end of sar up code
else
if (sar<iClose(Symbol(),times[x],0))
{
ObjectSetText("pozsignals"+x,CharToStr(Buy),10,"Wingdings",buycolour);
ObjectSetText("diffsignals"+x,DoubleToStr(iClose(Symbol(),times[x],0)-sar,Digits),10,"Times New Roman",buycolour);
}// end of sar down code
ObjectSetText("swingn"+x,DoubleToStr(iHigh(Symbol(),times[x],0)-iLow(Symbol(),times[x],0),Digits),10,"Times New Roman",Yellow);
}// end of sar values
//Alert("sar= "+ sar, "close" +iClose(Symbol(),times[x],0));
return(0);
}
//+------------------------------------------------------------------+
Comments