Freeway - All

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

The Freeway - All script is a market monitoring tool designed to identify strong directional trends across multiple currency pairs simultaneously. Instead of focusing on just one asset, it scans a broad list of major currencies to detect "clear roads" for trading, where several different timeframes all align in the same direction.

Core Logic and Workflow

1. Multi-Currency Surveillance The script monitors a specific list of 14 major currency pairs (such as EURUSD, GBPJPY, USDCHF, etc.). Depending on your settings, it can either scan this entire list at once or focus exclusively on the specific currency pair you are currently viewing on your chart.

2. Timeframe Synchronization The tool operates on a 15-minute refresh cycle. Every time a new 15-minute candle begins, the script performs a comprehensive check of the market conditions to ensure the data is current and consistent.

3. The "Freeway" Analysis For each currency pair being monitored, the script looks at four different timeframes:

  • 15-Minute (M15)
  • 30-Minute (M30)
  • 1-Hour (H1)
  • 4-Hour (H4)

It measures a technical indicator (CCI) on each of these timeframes. The goal is to find "confluence"—a situation where the short-term momentum and the long-term trends are moving in the same direction.

4. Identifying Clear Trends The logic follows a strict "all or nothing" rule to determine if a trend is strong enough to be considered a "Freeway":

  • Upward Trend: If the indicator is positive on all four timeframes simultaneously, the script identifies the road as clear to go "Up."
  • Downward Trend: If the indicator is negative on all four timeframes simultaneously, the script identifies the road as clear to go "Down."

User Notifications and Visuals

When the script detects that all timeframes have aligned in one direction, it performs three actions:

  • Alerting: It triggers an audible sound notification.
  • Logging: It prints a message in the system log stating which currency has a clear path and in what direction.
  • On-Screen Display: It updates a comment on your chart showing the current status of the monitored currencies.

If the timeframes are mixed (some going up, some going down) or do not meet the "all four" criteria, the script considers the road "blocked" and will not trigger an alert, helping you filter out uncertain market noise.

Indicators Used
Commodity channel index
Miscellaneous
It plays sound alerts
10 Views
0 Downloads
0 Favorites
Freeway - All
//+------------------------------------------------------------------+
//|                                                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