#Parabolic 4TF
Download scriptThis script is designed to provide traders with a multi-layered visual analysis of market trends by monitoring four different timeframes simultaneously. Instead of looking at just one chart, it synthesizes data from multiple perspectives (specifically the 1-minute, 5-minute, 15-minute, and 1-hour periods) into a single view.
Multi-Timeframe Synthesis
The core logic revolves around "confluence." The script pulls information from four distinct timeframes to determine the prevailing market direction. By doing this, it helps a trader see if a short-term move (like on a 1-minute chart) is supported by the larger trend occurring on the 1-hour chart.
Trend Identification
To determine the trend, the script relies on an external "Parabolic" calculation. It specifically looks for "flips" or shifts in these calculations across all four timeframes:
- Bullish Signals: When the conditions suggest an upward move, the script identifies this as a positive trend.
- Bearish Signals: When the conditions shift downward, it identifies this as a negative trend.
Visual Representation
The logic translates these complex multi-timeframe calculations into a clear visual output in a separate window:
- Directional Indicators: It uses specific markers (arrows) to signal whether the trend is moving up or down for each individual timeframe.
- Color Coding: The script uses distinct colors (Green/Lime for upward trends and Red for downward trends) to make it easy for the user to identify sentiment at a glance.
- Dynamic Labels: In addition to the markers, the script is designed to generate text labels on the chart. These labels correspond to each timeframe (M1, M5, M15, H1), allowing you to see exactly which timeframes are currently bullish or bearish based on their specific colors.
Summary for the User
In simple terms, this tool acts as a "Trend Dashboard." It automatically scans four different time periods at once and tells you, through colors and markers, whether the market is leaning toward a buy or sell signal across the entire spectrum—from the immediate micro-movements to the broader hourly trend.
//+------------------------------------------------------------------+
//| #Parabolic 4TF.mq4 |
//+------------------------------------------------------------------+
#property copyright "Kalenzo - code adapted to bars by cja"
#property link "http://www.foreksik.prv.pl"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 5
#property indicator_buffers 8
#property indicator_color1 Lime
#property indicator_color2 Lime
#property indicator_color3 Lime
#property indicator_color4 Lime
#property indicator_color5 Red
#property indicator_color6 Red
#property indicator_color7 Red
#property indicator_color8 Red
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];
extern int Maxbars = 1500;
extern double Step = 0.013;
extern double Maximum = 0.20;
extern int Precision = 4;
extern int TF1 = PERIOD_M1;
extern int TF2 = PERIOD_M5;
extern int TF3 = PERIOD_M15;
extern int TF4 = PERIOD_H1;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,110);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,110);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,110);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexEmptyValue(2,0.0);
SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(3,110);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexEmptyValue(3,0.0);
SetIndexStyle(4,DRAW_ARROW);
SetIndexArrow(4,110);
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexEmptyValue(4,0.0);
SetIndexStyle(5,DRAW_ARROW);
SetIndexArrow(5,110);
SetIndexBuffer(5,ExtMapBuffer6);
SetIndexEmptyValue(5,0.0);
SetIndexStyle(6,DRAW_ARROW);
SetIndexArrow(6,110);
SetIndexBuffer(6,ExtMapBuffer7);
SetIndexEmptyValue(6,0.0);
SetIndexStyle(7,DRAW_ARROW);
SetIndexArrow(7,110);
SetIndexBuffer(7,ExtMapBuffer8);
SetIndexEmptyValue(7,0.0);
IndicatorShortName("Para 4TF ( M"+TF1+" )( M"+TF2+" )( M"+TF3+" )( M"+TF4+" )");
RefreshRates();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectDelete("Para_Label");ObjectDelete("Para_Label1");ObjectDelete("Para_Label2");
ObjectDelete("Para_Label3");ObjectDelete("Para_Label4");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
int limit;
int TF[] = {0,0,0,0};
TF[0] = TF1;
TF[1] = TF2;
TF[2] = TF3;
TF[3] = TF4;
limit = MathMin(counted_bars,Maxbars);
if (limit ==0)
limit = Maxbars;
for (int ii=0; ii<limit; ii++)
{
ExtMapBuffer1[ii] = 0;
ExtMapBuffer2[ii] = 0;
ExtMapBuffer3[ii] = 0;
ExtMapBuffer4[ii] = 0;
ExtMapBuffer5[ii] = 0;
ExtMapBuffer6[ii] = 0;
ExtMapBuffer7[ii] = 0;
ExtMapBuffer8[ii] = 0;
for (int jj=0; jj<4; jj++)
{
int y = iBarShift(NULL, TF[jj], Time[ii]);
SetIndicator(GetCustomBars(TF[jj], y), jj, ii);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
bool GetCustomBars(int TF, int shift)
{
double h = iCustom(NULL,TF,"SAR_COLOR",Step,Maximum,Precision,0,shift);
double l = iCustom(NULL,TF,"SAR_COLOR",Step,Maximum,Precision,1,shift);
return(h<l);
}
void SetIndicator(bool isUP, int ind, int shift)
{
if (isUP)
{
switch (ind)
{
case 3: ExtMapBuffer1[shift] = ind+1; break;
case 2: ExtMapBuffer2[shift] = ind+1; break;
case 1: ExtMapBuffer3[shift] = ind+1; break;
case 0: ExtMapBuffer4[shift] = ind+1; break;
}
} else {
switch (ind)
{
case 3: ExtMapBuffer5[shift] = ind+1; break;
case 2: ExtMapBuffer6[shift] = ind+1; break;
case 1: ExtMapBuffer7[shift] = ind+1; break;
case 0: ExtMapBuffer8[shift] = ind+1; break;
}
/* ObjectDelete("Para");
ObjectCreate("Para", OBJ_LABEL,WindowFind("Para 4TF ( M"+TF1+" )( M"+TF2+" )( M"+TF3+" )( M"+TF4+" )"), 0, 0);
ObjectSetText("Para","STD Parabolic [ M"+TF1+" ][ M"+TF2+" ][ M"+TF3+" ][ M"+TF4+" ]", 8, "Tahoma Narrow", White);
ObjectSet("Para", OBJPROP_CORNER, 0);
ObjectSet("Para", OBJPROP_XDISTANCE, indicator_maximum);
ObjectSet("Para", OBJPROP_YDISTANCE, indicator_maximum );*/
color para_col,para_col60,para_col15,para_col5;
string PARAlabel="";
if(ExtMapBuffer4[0]>ExtMapBuffer8[0]){para_col=indicator_color4;}
if(ExtMapBuffer8[0]>ExtMapBuffer4[0]){para_col=indicator_color8;}
if(ExtMapBuffer1[0]>ExtMapBuffer5[0]){para_col60=indicator_color1;}
if(ExtMapBuffer5[0]>ExtMapBuffer1[0]){para_col60=indicator_color5;}
if(ExtMapBuffer2[0]>ExtMapBuffer6[0]){para_col15=indicator_color2;}
if(ExtMapBuffer6[0]>ExtMapBuffer2[0]){para_col15=indicator_color6;}
if(ExtMapBuffer3[0]>ExtMapBuffer7[0]){para_col5=indicator_color3;}
if(ExtMapBuffer7[0]>ExtMapBuffer3[0]){para_col5=indicator_color7;}
int Trend_Trigger;
if(Trend_Trigger==true){PARAlabel=" STD Parabolic";}
if(Trend_Trigger==false){PARAlabel=" STD Parabolic";}
/*ObjectDelete("Para_Label4");
if(ObjectFind("Para_Label4") != 0) {
ObjectCreate("Para_Label4", OBJ_TEXT,WindowFind("Para 4TF ( M"+TF1+" )( M"+TF2+" )( M"+TF3+" )( M"+TF4+" )"), Time[0],indicator_maximum-1);
ObjectSetText("Para_Label4", " "+PARAlabel+"",15, "Tahoma Narrow",para_col5);
} else{ ObjectMove("Para_Label4", 0, Time[0],indicator_maximum-1); } */
ObjectDelete("Para_Label");
if(ObjectFind("Para_Label") != 0) {
ObjectCreate("Para_Label", OBJ_TEXT,WindowFind("Para 4TF ( M"+TF1+" )( M"+TF2+" )( M"+TF3+" )( M"+TF4+" )"), Time[0],indicator_maximum-0.50);
ObjectSetText("Para_Label", " M"+TF4+"",7, "Tahoma Narrow",para_col60);
} else{ ObjectMove("Para_Label", 0, Time[0],indicator_maximum-0.50); }
ObjectDelete("Para_Label1");
if(ObjectFind("Para_Label1") != 0) {
ObjectCreate("Para_Label1", OBJ_TEXT,WindowFind("Para 4TF ( M"+TF1+" )( M"+TF2+" )( M"+TF3+" )( M"+TF4+" )"), Time[0],indicator_maximum-1.50);
ObjectSetText("Para_Label1", " M"+TF3+"",7, "Tahoma Narrow",para_col15);
} else{ ObjectMove("Para_Label1", 0, Time[0],indicator_maximum-1.50); }
ObjectDelete("Para_Label2");
if(ObjectFind("Para_Label2") != 0) {
ObjectCreate("Para_Label2", OBJ_TEXT,WindowFind("Para 4TF ( M"+TF1+" )( M"+TF2+" )( M"+TF3+" )( M"+TF4+" )"), Time[0],indicator_maximum-2.5);
ObjectSetText("Para_Label2", " M"+TF2+"",7, "Tahoma Narrow",para_col5);
} else{ ObjectMove("Para_Label2", 0, Time[0],indicator_maximum-2.5); }
ObjectDelete("Para_Label3");
if(ObjectFind("Para_Label3") != 0) {
ObjectCreate("Para_Label3", OBJ_TEXT,WindowFind("Para 4TF ( M"+TF1+" )( M"+TF2+" )( M"+TF3+" )( M"+TF4+" )"), Time[0],indicator_maximum-3.50);
ObjectSetText("Para_Label3", " M"+TF1+"",7, "Tahoma Narrow",para_col);
} else{ ObjectMove("Para_Label3", 0, Time[0],indicator_maximum-3.50); }
}
}
Comments