Freeway - All_v1
Download scriptOverview of the Freeway Indicator Logic
This tool is designed to provide traders with a real-time "traffic report" for various major currency pairs. It identifies clear market trends by analyzing technical data across multiple timeframes simultaneously, helping you see if the "road is clear" for a trade in a specific direction.
How the Logic Works
1. Multi-Currency Monitoring The script monitors a predefined list of popular currency pairs (such as EURUSD, GBPUSD, USDJPY, and others). Depending on your settings, it can either scan the entire list to give you a broad market overview or focus specifically on the currency pair you are currently viewing on your chart.
2. Timeframe Analysis Instead of looking at just one moment in time, the script examines four different timeframes for each currency:
- 15-Minute (M15)
- 30-Minute (M30)
- 1-Hour (H1)
- 4-Hour (H4)
By looking at these four different perspectives, the tool ensures that a trend is consistent across short-term movements and long-term trends.
3. The "Freeway" Condition The core logic relies on a specific technical indicator (CCI). For every currency checked, the script looks for "unanimous agreement" among the four timeframes:
- Upward Trend: If the data across all four timeframes shows a positive signal, it declares the "road clear" to go Up.
- Downward Trend: If the data across all four timeframes shows a negative signal, it declares the "road clear" to go Down.
If the signals are mixed (e.g., some timeframes are up and others are down), the script treats the market as "congested" and will not issue an alert.
4. Automated Alerts and Updates The script refreshes its analysis every 15 minutes to stay current with market movements. When a clear trend is identified:
- It displays a status comment on your chart showing the specific values for each timeframe.
- It triggers a visual alert on your screen.
- It plays an audible sound notification.
- It logs a message in the system's print log to confirm the direction of the move.
Summary for the Trader
Think of this as a navigation system for the forex market. It filters out the "noise" of minor fluctuations and only notifies you when all major timeframes are aligned in the same direction, suggesting a high-probability trend is currently active.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| Freeway - All.mq4 |
//| Copyright © 2006, Eli hayun |
//| http://www.elihayun.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Eli hayun"
#property link "http://www.elihayun.com"
#property indicator_chart_window
//---- input parameters
extern int CCI_Value=50;
extern bool UseCurrentCurrency = false;
string Currencies[] = {"AUDUSD","CHFJPY","EURAUD","EURCAD","EURCHF","EURGBP",
"EURJPY","EURUSD","GBPCHF","GBPJPY","GBPUSD","USDCAD",
"USDCHF","USDJPY"};
string Alerted[] = {"","","","","","","","","","","","","",""};
string sComment = "", sCurrComment = "";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
bool GoCheck;
// For every 15 minutes check if the freeway is open (all > 0 or all < 0)
if (NewBar())
{
sComment = "";
for (int ii=0; ii<ArraySize(Currencies); ii++)
{
GoCheck = !UseCurrentCurrency;
if (UseCurrentCurrency)
if (Symbol() == Currencies[ii])
GoCheck = true;
if (GoCheck)
{
CheckFreeway(Currencies[ii],ii);
if (sCurrComment != "")
sComment = sCurrComment + "\n" + sComment;
}
}
if (sComment != "")
Comment(sComment);
}
return(0);
}
//+------------------------------------------------------------------+
bool NewBar()
{
static datetime dt = 0;
if (iTime(NULL, PERIOD_M15, 0) != dt)
{
dt = iTime(NULL, PERIOD_M15, 0);
return(true);
}
return(false);
}
void CheckFreeway(string Curr, int idx)
{
int cci[4];
int tf[4] = {PERIOD_M15, PERIOD_M30, PERIOD_H1, PERIOD_H4};
string tfName[4] = {"M15", "M30", "H1", "H4"};
string sDir = "";
sCurrComment = Curr + ": ";
for (int ii=0; ii<4; ii++)
{
double c = iCCI(Curr, tf[ii], CCI_Value, PRICE_TYPICAL, 0);
sCurrComment = sCurrComment + " " + tfName[ii] + ": " + DoubleToStr(c,4);
cci[ii] = -1;
if (c > 0) cci[ii] = 1;
if (c < 0) cci[ii] = 0;
}
// If all values in cci[] are 1 - go up
// If all values in cci[] are 0 - go down
if (cci[0] + cci[1] + cci[2] + cci[3] == 4)
sDir = "Up";
if (cci[0] + cci[1] + cci[2] + cci[3] == 0)
sDir = "Down";
if (sDir != "" && (Alerted[idx] != sDir))
{
Print("Freeway: ", Curr, " road clear to go ", sDir);
PlaySound("alert1.wav");
Alerted[idx] = sDir;
} else {
sCurrComment = "";
}
}
Comments