Freeway - All1

Download script
Author: Copyright � 2006, Eli hayun
Freeway - All1

The Freeway indicator is a multi-currency analysis tool designed to scan various forex currency pairs simultaneously to identify synchronized market trends. Instead of looking at just one chart, it monitors the "momentum" of several major currencies across different timeframes to determine if there is a clear, unobstructed path for a trade.

How the Logic Works

1. Multi-Timeframe Analysis The tool evaluates each currency pair across four distinct timeframes: 15 minutes (M15), 30 minutes (M30), 1 hour (H1), and 4 hours (H4). By looking at these different durations at once, the script ensures that a trend isn't just a short-term spike, but rather a consistent movement occurring across both short-term and long-term horizons.

2. The Momentum Filter (CCI) To decide the direction of a currency, the script uses a technical indicator called the Commodity Channel Index (CCI). It checks if the CCI value is above or below zero:

  • Positive Value: Indicates upward momentum.
  • Negative Value: Indicates downward momentum.

3. The "Freeway" Concept The core logic of the tool is based on total synchronization. For a currency to be considered "Clear" (the Freeway being open), the momentum must be identical across all four timeframes analyzed:

  • Upward Trend: If all four timeframes show positive momentum simultaneously, the tool identifies the path as clear to go "Up."
  • Downward Trend: If all four timeframes show negative momentum simultaneously, it identifies the path as clear to go "Down."

If the momentum is mixed (e.g., some timeframes are up while others are down), the script considers the road "blocked" and will not issue an alert.

4. Automated Scanning & Notifications The script automates several tasks for the user:

  • Currency Selection: It can be configured to monitor a pre-defined list of major currencies (like EURUSD, GBPJPY, etc.) or focus exclusively on the specific currency currently open on your chart.
  • Automatic Updates: The tool refreshes its data every 15 minutes.
  • Smart Alerts: To prevent repetitive notifications, the script only triggers an alert when the "Freeway" status actually changes. For example, if a currency switches from a mixed state to a synchronized "Up" state, you will receive a visual alert and a sound notification.
  • On-Screen Display: It provides a live text summary on your chart showing the current momentum values for each monitored currency, allowing you to see the status of the market at a glance.
Indicators Used
Commodity channel index
Miscellaneous
It issuies visual alerts to the screenIt plays sound alerts
8 Views
0 Downloads
0 Favorites
Freeway - All1
//+------------------------------------------------------------------+
//|                                                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))
   {
      Alert("Freeway: ", Curr, " road clear to go ", sDir);
      PlaySound("alert1.wav");
      Alerted[idx] = sDir;
   } else {
      sCurrComment = "";
   }
}

Comments