All stoch 60min
Download scriptThis tool is designed as a comprehensive visual aid for traders who want to analyze market momentum across multiple timeframes simultaneously. Rather than forcing you to switch back and forth between different charts (like moving from a 1-hour chart to a Daily chart), this script consolidates that information into a single, unified view.
Core Functionality
The primary logic of the script centers on "Multi-Timeframe Analysis." It automatically fetches data from several time periods—ranging from shorter durations like the 1-hour (H1) to much longer ones like the Monthly (MN1)—and projects them onto your current screen. This allows you to see how the broader market trend aligns with your immediate trading timeframe at a glance.
Key Features and Behavior
- Stochastic Momentum Tracking: The script utilizes the "Stochastic Oscillator," a common technical indicator used to identify overbought or oversold conditions. It tracks two primary lines: the main momentum line and a signal line.
- Timeframe Integration: Depending on your settings, the tool can display data from three different timeframes (H1, H4, D1) or five larger ones (H1 through MN1). It intelligently organizes these so you can see the "big picture" without cluttering your workspace.
- Visual Organization:
- Labels: The script places text labels on the chart to identify which line belongs to which timeframe (e.g., identifying where the H4 data starts vs. the Daily data).
- Separators: To keep the data readable, it uses vertical separators. These act as visual boundaries to distinguish between different timeframes, ensuring that the lines from one period do not blend confusingly into another.
- Customizable Smoothing: You can adjust how "fast" or "slow" the indicators react by changing the periods and slowing parameters, allowing you to filter out market noise according to your personal trading style.
- Dynamic Shifting: The script includes a "Shift Right" option. This is useful for traders who prefer to see the data slightly offset from the current live candle to avoid visual overlap with the most recent price action.
Summary for the User
In simple terms, this tool acts as a multi-lane highway map. Instead of looking at five different maps to see where you are going, this script puts all five maps side-by-side on one page. It helps you verify if the long-term "ocean currents" (Monthly/Weekly trends) match the "local waves" (Hourly/Daily movements), providing a clearer perspective for making informed trading decisions.
//+------------------------------------------------------------------+
//| All Stochastic.mq4 |
//| mladen |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link ""
#define indicatorName "All Stochastic"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 2
#property indicator_color1 Gold
#property indicator_color2 Maroon
#property indicator_style2 STYLE_DOT
#property indicator_level1 20
#property indicator_level3 80
#property indicator_levelcolor DimGray
//---- input parameters
//
//
//
//
//
extern int Kperiod = 5;
extern int Dperiod = 3;
extern int Slowing = 3;
extern int MAMethod = 0;
extern int PriceField = 0;
extern bool showHigherTimeframes = true;
extern int barsPerTimeFrame = 35;
extern bool shiftRight = False;
extern color txtColor = Silver;
extern color separatorColor = DimGray;
//---- buffers
//
//
//
//
//
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//
//
//
//
//
string shortName;
string labelsShort[] = {"H1","H4","D1"};
string labelsLong[] = {"H1","H4","D1","W1","MN1"};
string labels[];
int periodsShort[] = {PERIOD_H1,PERIOD_H4,PERIOD_D1};
int periodsLong[] = {PERIOD_H1,PERIOD_H4,PERIOD_D1,PERIOD_W1,PERIOD_MN1};
int periods[];
int Shift;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if (shiftRight) Shift = 1;
else Shift = 0;
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexShift(0,Shift*(barsPerTimeFrame+1));
SetIndexShift(1,Shift*(barsPerTimeFrame+1));
//
//
//
//
//
barsPerTimeFrame = MathMax(barsPerTimeFrame,30);
SetIndexLabel(0,"Stochastic");
SetIndexLabel(1,"Signal");
shortName = indicatorName+" ("+Kperiod+","+Dperiod+","+Slowing+")";
IndicatorShortName(shortName);
if (showHigherTimeframes) {
ArrayCopy(labels,labelsLong);
ArrayCopy(periods,periodsLong);
}
else {
ArrayCopy(labels,labelsShort);
ArrayCopy(periods,periodsShort);
}
//
//
//
//
//
for (int i=1;i<7;i++)
if (Period()==periods[i])
{
string tmpLbl = labels[i];
int tmpPer = periods[i];
//
//
//
//
//
for (int k=i ;k>0; k--)
{
labels[k] = labels[k-1];
periods[k] = periods[k-1];
}
labels[0] = tmpLbl;
periods[0] = tmpPer;
}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
for(int l=0;l<7;l++)
{
ObjectDelete(indicatorName+l);
ObjectDelete(indicatorName+l+1);
}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
string on;
int wn=WindowFind(shortName);
int k=0;
//
//
//
//
//
for(int p=0; p<7;p++)
{
for(int i=0; i<barsPerTimeFrame;i++,k++)
{
ExtMapBuffer1[k] = iStochastic(NULL,periods[p],Kperiod,Dperiod,Slowing,MAMethod,PriceField,0,i);
ExtMapBuffer2[k] = iStochastic(NULL,periods[p],Kperiod,Dperiod,Slowing,MAMethod,PriceField,1,i);
}
k += 1;
ExtMapBuffer1[k] =EMPTY_VALUE;
ExtMapBuffer2[k] =EMPTY_VALUE;
//
//
//
//
//
on = indicatorName+p;
if(ObjectFind(on)==-1)
ObjectCreate(on,OBJ_TREND,wn,0,0);
ObjectSet(on,OBJPROP_TIME1,myTime(k-Shift*(barsPerTimeFrame+1)-1));
ObjectSet(on,OBJPROP_TIME2,myTime(k-Shift*(barsPerTimeFrame+1)-1));
ObjectSet(on,OBJPROP_PRICE1, 0);
ObjectSet(on,OBJPROP_PRICE2,100);
ObjectSet(on,OBJPROP_COLOR ,separatorColor);
ObjectSet(on,OBJPROP_WIDTH ,2);
on = indicatorName+p+1;
if(ObjectFind(on)==-1)
ObjectCreate(on,OBJ_TEXT,wn,0,0);
ObjectSet(on,OBJPROP_TIME1,myTime(k-Shift*(barsPerTimeFrame+1)-6));
ObjectSet(on,OBJPROP_PRICE1,100);
ObjectSetText(on,labels[p],9,"Arial",txtColor);
}
//
//
//
//
//
SetIndexDrawBegin(0,Bars-k);
SetIndexDrawBegin(1,Bars-k);
return(0);
}
//+------------------------------------------------------------------+
//+ Custom functions and procedures +
//+------------------------------------------------------------------+
int myTime(int a)
{
if(a<0)
return(Time[0]+Period()*60*MathAbs(a));
else return(Time[a]);
}
Comments