Sniper_Tools_v2
Download scriptThe Sniper Tools script is a specialized technical analysis tool designed for the MetaTrader platform. Its primary purpose is to identify high-probability trading opportunities by scanning multiple timeframes simultaneously to find specific alignment in market momentum.
Core Logic Overview
The tool functions by looking for "confluence." Rather than making a decision based on a single chart view, it analyzes the current 5-minute price action against three larger, higher timeframes (the 1-hour, 4-hour, and daily charts). It looks for specific relationships between the MACD (Moving Average Convergence Divergence) histograms across all these levels.
How It Works
To identify a potential trade signal, the script performs the following steps:
- Multi-Timeframe Synchronization: The tool automatically maps the current time on your 5-minute chart to the corresponding points in time on the 1-hour, 4-hour, and Daily charts. This ensures that it is comparing "apples to apples"—looking at what is happening right now across different scales.
- Momentum Filtering: It checks the momentum (MACD Histogram) for each of these four timeframes.
- Signal Identification: The script places a visual marker (an arrow) on your chart only when very specific conditions are met:
- Bearish Signal: It identifies a potential downward move if the momentum is negative (below zero) on all four timeframes simultaneously. When this happens, it marks the "High" of the price candle.
- Bullish Signal: It looks for a specific divergence where the current 5-minute momentum is positive (above zero), while the 4-hour and Daily momentum remain negative (below zero). When this specific structural setup occurs, it marks the "Low" of the price candle.
Key Features for the User
- Visual Indicators: Instead of forcing you to read complex data tables, the tool places gold arrows directly on your main chart to highlight these specific moments.
- Automated Scanning: The script handles all the heavy lifting of calculating multiple indicators across different timeframes in real-time, allowing you to focus on the visual cues provided.
- Timeframe Specificity: The tool is optimized specifically for the 5-minute chart, acting as a "sniper" tool to find precise entries based on broader market trends.
//+------------------------------------------------------------------+
//| Sniper Tools.mq4 |
//+------------------------------------------------------------------+
//| Sniper Tools.mq4 |
//| Colin Reeve |
//| midworld08@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Colin Reeve"
#property link "midworld08@gmail.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Gold
#property indicator_style1 DRAW_ARROW
#define graphics_multiplier 200
//---- External inputs from user
extern int MACD_FastMAPeriod=12,
MACD_SlowMAPeriod=26,
MACD_SignalMAPeriod=9;
int period[]={1,5,15,30,60,240,1440,10080,43200}; //array used to pass variables repeatedly to indicators
string periodString[]={"M1","M5","M15","M30","H1","H4","D1","W1","MN1"}; //arrays used to show time value above arrows
double Activator_Buffer[];
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//set up the activator symbol to show the sniper active Symbol
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,181);
SetIndexBuffer(0,Activator_Buffer);
SetIndexEmptyValue(0,0.0);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//time to figure out which bars of the currently shown graph have the MACD travelling in the same direction
double MACD_Histo, MACD_Histo1, MACD_Histo2, MACD_Histo3, MACD_Histo4;
int Current_Chart_Period=Period(); //fetch the current period of the chart
int Next_Chart_Period1, Next_Chart_Period2, Next_Chart_Period3,Next_Chart_Period4;
int i=0,Current_Chart_Pos,Higher_Chart_Period_Pos1,
Higher_Chart_Period_Pos2,Higher_Chart_Period_Pos3,Higher_Chart_Period_Pos4;
datetime Bar_Time;
if (Current_Chart_Period!=5) return(0); //if not in the M5 chart exit indicator
// while (Current_Chart_Period!=period[i]) //remove from commenting to change to iterate through next higher time periods
// {
// i++;
// }
Next_Chart_Period1=60; //period[i+1]; //need to know the next higher time frame
Next_Chart_Period2=240; //period[i+2];
Next_Chart_Period3=1440; //period[i+3];
// Next_Chart_Period4=period[i+4];
Current_Chart_Pos=Bars-2;
if(ExtCountedBars>2) Current_Chart_Pos=Bars-ExtCountedBars-1;
//---- main calculation loop
while(Current_Chart_Pos>=0)
{
Bar_Time=Time[Current_Chart_Pos]; //fetch the current bar time
Higher_Chart_Period_Pos1=iBarShift(NULL,Next_Chart_Period1,Bar_Time); //search the next higher time frame for the bar position containing this time
Higher_Chart_Period_Pos2=iBarShift(NULL,Next_Chart_Period2,Bar_Time);
Higher_Chart_Period_Pos3=iBarShift(NULL,Next_Chart_Period3,Bar_Time);
// Higher_Chart_Period_Pos4=iBarShift(NULL,Next_Chart_Period4,Bar_Time);
//get the MACD values for the current chart period and bar
MACD_Histo = iCustom(NULL,Current_Chart_Period,"iMACD",MACD_FastMAPeriod,MACD_SlowMAPeriod,MACD_SignalMAPeriod,2,Current_Chart_Pos);
MACD_Histo1 = iCustom(NULL,Next_Chart_Period1,"iMACD",MACD_FastMAPeriod,MACD_SlowMAPeriod,MACD_SignalMAPeriod,2,Higher_Chart_Period_Pos1);
MACD_Histo2 = iCustom(NULL,Next_Chart_Period2,"iMACD",MACD_FastMAPeriod,MACD_SlowMAPeriod,MACD_SignalMAPeriod,2,Higher_Chart_Period_Pos2);
MACD_Histo3 = iCustom(NULL,Next_Chart_Period3,"iMACD",MACD_FastMAPeriod,MACD_SlowMAPeriod,MACD_SignalMAPeriod,2,Higher_Chart_Period_Pos3);
// MACD_Histo4 = iCustom(NULL,Next_Chart_Period4,"iMACD",MACD_FastMAPeriod,MACD_SlowMAPeriod,MACD_SignalMAPeriod,2,Higher_Chart_Period_Pos4);
Activator_Buffer[Current_Chart_Pos]=0.0; //set buffer to zero for default value
if (MACD_Histo<0)
if (MACD_Histo1<0)
if (MACD_Histo2<0)
if (MACD_Histo3<0)
// if (MACD_Histo4<0)
Activator_Buffer[Current_Chart_Pos]=High[Current_Chart_Pos];
if (MACD_Histo>0)
if (MACD_Histo1>0)
if (MACD_Histo2<0)
if (MACD_Histo3<0)
// if (MACD_Histo4<0)
Activator_Buffer[Current_Chart_Pos]=Low[Current_Chart_Pos] ;
Current_Chart_Pos--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments