// <![CDATA[
// Begin Ad Muncher helper script
// Do not remove without removing all references to this in the below page (eg: everything containing "WXZ" or "WXb")
// Original URL:   http://www.forextradingplus.com/indicators/Freeway%20-%20All1.mq4
// Retrieved from: 195.58.9.193:3128
function WXZn(){return false;};
function WXZbHelp(a,b){WXZYgp(a);WXZYbn();return;};
function WXZb(a,b,c,d){WXZYgp(a);WXZYbn();return WXZYfw(b);};
function WXZYpp(a){WXZYppa=a;if(a)WXZYorgsti("WXZYppa=0;",500);};
function WXZbtePopup(a,b,c,d,e,f){WXZYgp();WXZYbn();return WXZYfw();};
function WXZbModalDialog(a,b,c){WXZYgp(a);WXZYbn();return WXZYfw();};
function WXZYj(m,u,l){if(WXZYolp){WXZYqn=WXZYqnbu;WXZYolp=0;};return true;};
function WXZbModelessDialog(a,b,c){WXZYgp(a);WXZYbn();return WXZYfw();};
function WXZYpl(a,b,c){while(a.indexOf(b)!=-1)a=a.replace(b,c);return a;};
function WXZYtry(a,z){if(WXZYtryk())eval("try{"+a+"}catch(e){};");else eval(a);};
function WXZc(){WXZYqn=WXZYqnbu=10;WXZYorgsti("WXZYqn=WXZYqnbu=0;",500);return;};
function WXZY__amscript_addonload(a){WXZY_ams_onload[WXZY_ams_onload_i++]=(typeof(a)=="function")?a:new Function(a);};
function WXZY__amscript_addonunload(a){WXZY_ams_onunload[WXZY_ams_onunload_i++]=(typeof(a)=="function")?a:new Function(a);};
function WXZYfcs(z){WXZYfcsr=0;if(z){WXZYfcsrz=z;WXZYtry("WXZYfcsr=WXZYfcsd();");};return WXZYfcsr;};
function WXZYfc(a,z){for(var i=0;i<a.length;i++)if(a[i].name==z||WXZYfc(a[i].frames,z))return 1;return 0;};
function WXb(z){if(typeof(z.location)!="undefined"||typeof(z.blur)=="undefined")return false;return z.blur();};
function WXZf(z){if(typeof(z.location)!="undefined"||typeof(z.focus)=="undefined")return false;return z.focus();};
function WXZYHelp(a,b){if(WXZYck(a))return;if(WXZYqn)WXZYqn-=1;if(b)return showHelp(a,b);else return showHelp(a);};
function WXZTimeout(a,b){if(((!WXZYqn&&!WXZYa)||WXZYppa||WXZYul)&&typeof(a)=="string")return WXZYorgsti("WXZYpp(1);"+a+";WXZYpp(0);",b);return WXZYorgsti(a,b);};
function WXZInterval(a,b){if(((!WXZYqn&&!WXZYa)||WXZYppa||WXZYul)&&typeof(a)=="string")return WXZYorgsin("WXZYpp(1);"+a+";WXZYpp(0);",b);return WXZYorgsin(a,b);};
function WXZYbn(){if(WXZYd&&WXZYm){if(WXZYb){WXZYc="s";WXZYb+=", "+WXZYm;}else{WXZYc="";WXZYb=WXZYm;};WXZYi="Popup"+WXZYc+" on page blocked by Ad Muncher: "+WXZYb;WXZYu();};};
function WXZYox(){var x;for(var i=0;i<WXZY_ams_onunload.length;i++){if(typeof(WXZY_ams_onunload[i])=="function")WXZY_ams_onunload[i]();};if(typeof(WXZYffad)!="undefined"&&!WXZYffadd){if(WXZYkou)WXZYul=1;WXZYffadd=1;if(typeof(WXZYffad)=="function")x=WXZYffad();else eval(WXZYffad);WXZYul=0;};return x;};
function WXZYModalDialog(a,b,c){if(WXZYck(a,b))return WXZYfw();if(WXZYqn)WXZYqn-=1;if(c)return showModalDialog(a,b,c);else if(b)return showModalDialog(a,b);else return showModalDialog(a);};
function WXZYs(a){if((typeof(a.target)!="undefined"&&typeof(a.action)!="undefined"&&a.target&&WXZYnw(a.target)&&WXZYck(a.action))||typeof(a.submit)=="undefined")return false;return a.submit();};
function WXZYt(a){if((WXZYqn||WXZYa)&&!WXZYppa&&!WXZYul){if(WXZYqn)WXZYqn-=1;return alert(a);};if(a&&WXZYd){WXZYi="Alert message blocked by Ad Muncher: "+WXZYpl(a,"\n"," ");WXZYu();};return false;};
function WXZYModelessDialog(a,b,c){if(WXZYck(a,b))return WXZYfw();if(WXZYqn)WXZYqn-=1;if(c)return showModelessDialog(a,b,c);else if(b)return showModelessDialog(a,b);else return showModelessDialog(a);};
function WXZYsp(a,z){if(a.split)return a.split(z);var j,c,s,n,b,e;j=b=0;c=on.length;s=new Array();a+=z;n=a.length;while(b<n){e=z?a.indexOf(z,b):b+1;s[j++]=a.substring(b,e);b=e+c;};return s.length=j,s;};
function WXZYu(a){WXZYi=WXZYpl(WXZYpl(WXZYi.substring(0,1024),'"',"<~am~`"),"<~am~`",'\\"');WXZYir='defaultStatus="'+WXZYi+'";';if(!WXZYss){WXZYss=1;WXZYorgsin("eval(WXZYir);",3000);};WXZYorgsti("eval(WXZYir);",1000);};
function WXZYe(){WXZYa=0;WXZYqnbu=WXZYqn;WXZYqn=0;WXZYolp=1;WXZYorgsti("WXZYa=1;",1000);if(!WXZYffd){WXZYffd=1;for(var i=0;i<WXZY_ams_onload.length;i++){if(typeof(WXZY_ams_onload[i])=="function")WXZY_ams_onload[i]();};if(typeof(WXZYff)!="undefined"){if(typeof(WXZYff)=="function")WXZYff();else eval(WXZYff);};};WXZYqn=WXZYqnbu;WXZYolp=0;WXZYx();};
function WXZYnw(a){WXZYagt=navigator.userAgent.toLowerCase();if(a!="_self"&&a!="_top"&&a!="_main"&&a!="_parent"&&!WXZYfcs(a)&&((WXZYagt.indexOf("msie")==-1||WXZYagt.indexOf("opera")!=-1)||(a!="_search"&&a!="_media")))return 1;return 0;};
function WXZYobx(){var x;if(typeof(WXZYffreunload)!="undefined"&&!WXZYffreunloadd){if(WXZYkou)WXZYul=1;WXZYffreunloadd=1;if(typeof(WXZYffreunload)=="function")x=WXZYffreunload();else eval(WXZYffreunload);WXZYffreunloadd=0;WXZYul=0;};return x;};
function WXZYtryk(){var b=navigator.userAgent.toLowerCase();var c=parseInt(navigator.appVersion);if((b.indexOf("mozilla")!=-1&&b.indexOf("compatible")== -1&&c>=5)||(b.indexOf("opera")!=-1&&c>=6)||(b.indexOf("msie")!=-1&&c>=4))return 1;return 0;};
function WXZYfcsd(){var v=self;if(WXZYfc(v.frames,WXZYfcsrz)||(typeof(v.name)!="undefined"&&v.name==WXZYfcsrz))return 1;while(v!=v.parent){v=v.parent;if(WXZYfc(v.frames,WXZYfcsrz)||(typeof(v.name)!="undefined"&&v.name==WXZYfcsrz))return 1;};return 0;};
function WXZYtePopup(a,b,c,d,e,f){if(WXZYck())return WXZYfw();if(WXZYqn)WXZYqn-=1;if(f)return createPopup(a,b,c,d,e,f);else if(e)return createPopup(a,b,c,d,e);else if(d)return createPopup(a,b,c,d);else if(c)return createPopup(a,b,c);else if(b)return createPopup(a,b);else return createPopup(a);};
function WXZYmc(){if(typeof(document.layers)!="undefined")document.captureEvents(Event.KeyDown|Event.MouseUp|Event.Blur|Event.KeyPress|Event.Move|Event.Click|Event.KeyUp|Event.Reset|Event.Change|Event.Load|Event.Resize|Event.DblClick|Event.MouseDown|Event.Select|Event.DragDrop|Event.MouseMove|Event.Submit|Event.Error|Event.MouseOut|Event.Unload|Event.Focus|Event.MouseOver);document.onmousedown=WXZYr;return 0;};
function WXZYck(a,b){if(!WXZYul&&!WXZYppa&&(WXZYro||WXZYqn||WXZYa||(b&&!WXZYnw(b)))){return 0;};WXZYgp(a);var l,s,c;for(var i=0;i<WXZYpmx.length;i++){l=0;s=WXZYsp(WXZYpmx[i],"*");for(var z=0;z<s.length;z++){c=WXZYn.indexOf(s[z],l);if(c==-1){l=0;break;};l=c;};if(l)return 0;};WXZYbn();if(WXZYrp){WXZYrpi5=WXZYrpi4;WXZYrpi4=WXZYrpi3;WXZYrpi3=WXZYrpi2;WXZYrpi2=WXZYrpi1;WXZYrpi1=new Image();var WXZYzn;WXZYtry("WXZYzn=document.referrer");WXZYrpi1.src="http://www.admuncher.com/cgi-bin/pr.pl?p="+escape(WXZYm)+"&s="+escape(document.location.href)+"&r="+escape(WXZYzn)+"&v=4.7.27105&l=1371";};return 1;};
function WXZYr(e){if((e&&e.which==1)||(typeof(window.event)!="undefined"&&window.event.button==1)){WXZYqn=WXZYqnbu=10;WXZYorgsti("WXZYqn=WXZYqnbu=0;",500);if(typeof(document.WXZYusedown)!="undefined"){if(typeof(document.WXZYusedown)=="function")return document.WXZYusedown(e);else return eval(document.WXZYusedown);};};if(typeof(document.WXZYusedown)!="undefined"){if(e||typeof(window.event)!="undefined"){if(typeof(document.WXZYusedown)=="function"){WXZYpp(0);var WXZYtn=document.WXZYusedown(e);WXZYpp(1);return WXZYtn;}else return eval("WXZYpp(1);"+document.WXZYusedown+";WXZYpp(0);");};if(typeof(document.WXZYusedown)=="function")return document.WXZYusedown(e);else return eval(document.WXZYusedown);};return true;};
function WXZYx(){WXZYtry('if(typeof(window.onload)=="undefined")window.onload=WXZYe;else{WXZYq=""+window.onload;if(!window.onload||!WXZYq||WXZYq.indexOf("WXZYe")!=-1)window.onload=WXZYe;};if(typeof(window.onunload)=="undefined")window.onunload=WXZYox;else{WXZYq=""+window.onunload;if(!window.onunload||!WXZYq||WXZYq.indexOf("WXZYox")!=-1)window.onunload=WXZYox;};if(typeof(window.onbeforeunload)=="undefined")window.onbeforeunload=WXZYobx;else{WXZYq=""+window.onbeforeunload;if(!window.onbeforeunload||!WXZYq||WXZYq.indexOf("WXZYobx")!=-1)window.onbeforeunload=WXZYobx;};if(typeof(window.onmousedown)=="undefined")WXZYmc();else{WXZYq=""+document.onmousedown;if(!window.onmousedown||!WXZYq||WXZYq.indexOf("WXZYr")!=-1){WXZYmc();};};');};
function WXZYgp(a){if(a){var WXZYckjs=/[A-Za-z]+:/;if(a.search(WXZYckjs)!=-1){if(a.substring(0,5).toLowerCase()!="http:"){WXZYm="(No URL)";WXZYn=a.toLowerCase()+" "+document.URL.toLowerCase();return;};};WXZYp="/admuncherpopcheck&"+Math.random()+"&"+document.URL;WXZYmi3=WXZYmi2;WXZYmi2=WXZYmi1;WXZYmi1=new Image();WXZYn=a;WXZYnn=WXZYn.indexOf("#");if(WXZYnn!=-1)WXZYn=WXZYn.substring(0,WXZYnn);WXZYmi1.src=WXZYn+WXZYp;WXZYnn=WXZYmi1.src.indexOf(WXZYp);if(WXZYnn!=-1)WXZYm=WXZYmi1.src.substring(0,WXZYnn);WXZYn=WXZYm.toLowerCase()+" "+document.URL.toLowerCase();}else{WXZYm="(No URL)";WXZYn=document.URL.toLowerCase();WXZYp="/admuncherpopchecknourl&"+Math.random();WXZYmi3=WXZYmi2;WXZYmi2=WXZYmi1;WXZYmi1=new Image();WXZYmi1.src=document.URL+WXZYp;};};
function WXZY(a,b,c,d){if(WXZYck(a,b))return WXZYfw(b);if(WXZYqn)WXZYqn-=1;if(!a)a="";if(typeof(c)=="string"){c=WXZYpl(c.toLowerCase()," ","");if(WXZYw){c=WXZYpl(c,"height=","xxx=");c=WXZYpl(c,"width=","xxx=");c=WXZYpl(c,"top=","xxx=");c=WXZYpl(c,"left=","xxx=");c=WXZYpl(c,"screenx=","xxx=");c=WXZYpl(c,"screeny=","xxx=");};if(WXZYy){c=WXZYpl(c,"location=","xxx=");c=WXZYpl(c,"toolbar=","xxx=");c=WXZYpl(c,"menubar=","xxx=");c=WXZYpl(c,"resizable=","xxx=");c=WXZYpl(c,"scrollbars=","xxx=");c=WXZYpl(c,"status=","xxx=");c=WXZYpl(c,"titlebar=","xxx=");c=WXZYpl(c,"fullscreen=","xxx=");c=WXZYpl(c,"directories=","xxx=");};};if(WXZYy){if(typeof(c)=="string")c+=",";else c="";c+="location,toolbar,menubar,resizable,scrollbars,status,titlebar,directories";};if(d)return WXZYorgo(a,b,c,d);else if(c)return WXZYorgo(a,b,c);else if(b)return WXZYorgo(a,b);else return WXZYorgo(a);};
function WXZYso(c,a){if(typeof(a)=="string"&&a.substring(0,11)=="javascript:"){a=a.substring(11,a.length);};if(typeof(WXZYsod[c])=="undefined"||!WXZYsod[c]){WXZYsod[c]=1;var x=new Array('quot22','amp26','lt3C','gt3E','nbspA0','iexclA1','centA2','poundA3','yenA5','brvbarA6','sectA7','umlA8','copyA9','ordfAA','laquoAB','notAC','shyAD','regAE','macrAF','degB0','plusmnB1','sup2B2','sup3B3','acuteB4','microB5','paraB6','middotB7','cedilB8','sup1B9','ordmBA','raquoBB','frac14BC','frac12BD','frac34BE','iquestBF','AgraveC0','AacuteC1','AcircC2','AtildeC3','AumlC4','AringC5','AEligC6','CcedilC7','EgraveC8','EacuteC9','EcircCA','EumlCB','IgraveCC','IacuteCD','IcircCE','IumlCF','ETHD0','NtildeD1','OgraveD2','OacuteD3','OcircD4','OtildeD5','OumlD6','timesD7','OslashD8','UgraveD9','UacuteDA','UcircDB','UumlDC','YacuteDD','THORNDE','szligDF','agraveE0','aacuteE1','acircE2','atildeE3','aumlE4','aringE5','aeligE6','ccedilE7','egraveE8','eacuteE9','ecircEA','eumlEB','igraveEC','iacuteED','icircEE','iumlEF','ethF0','ntildeF1','ograveF2','oacuteF3','ocircF4','otildeF5','oumlF6','divideF7','oslashF8','ugraveF9','uacuteFA','ucircFB','uumlFC','yacuteFD','thornFE','yumlFF');var l,m;for(var i=0;i<x.length;i++){if (typeof(x[i])=="string"){l=x[i].length;m="&"+x[i].substring(0,(l-2))+";";a=WXZYpl(a,m,unescape("%"+x[i].substring((l-2),l)));};};if(c==1)WXZYff=new Function(a);if(c==2)WXZYffad=new Function(a);if(c==3)WXZYffreunload=new Function(a);};};
function WXZYfw(b){var r=new Object();for(i in window)r[i]=window[i];var v=new Array("scrollBy","getSelection","scrollByLines","scrollByPages","sizeToContent","dump","setTimeout","setInterval","clearTimeout","clearInterval","setResizable","captureEvents","releaseEvents","routeEvent","enableExternalCapture","disableExternalCapture","prompt","open","openDialog","find","alert","confirm","focus","blur","back","forward","home","stop","print","moveTo","moveBy","resizeTo","resizeBy","scroll","close","show","updateCommands","escape","unescape","atob","btoa","addEventListener","removeEventListener","dispatchEvent","getComputedStyle");for(var i=0;i<v.length;i++)r[v[i]]=WXZn;v=new Array("captureEvents","close","open","releaseEvents","clear","writeln","getElementById","getElementsByName","elementFromPoint","createEvent","getSelection","write","createElement","createElementNS","createDocumentFragment","createTextNode","createComment","createAttribute","getElementsByTagName","importNode","attachEvent","detachEvent","hasAttributes","addEventListener","removeEventListener","dispatchEvent","contains","insertBefore","replaceChild","removeChild","appendChild","hasChildNodes","isSupported","normalize","cloneNode");r.document=new Object();for(var i=0;i<v.length;i++)r.document[v[i]]=WXZn;r.document.body=new Object();r.document.body.style=new Object();r.name=b;r.amwin="a";r.location=new Object(WXZYm);r.location.href=WXZYm;r.location.hash=window.location.hash;r.location.host=window.location.host;r.location.hostname=window.location.hostname;r.location.pathname=window.location.pathname;r.location.port=window.location.port;r.location.protocol=window.location.protocol;r.location.search=window.location.search;WXZYclct+=1;eval("WXZYpc["+WXZYclct+"]=r;WXZYorgsti(\"WXZYpc["+WXZYclct+"].closed=true;\",1500);");return r;};
if(typeof(self.WXZYinited)=="undefined"){
var WXZYinited=1;var WXZYa,WXZYb,WXZYc,WXZYd,WXZYi,WXZYir,WXZYk,WXZYm,WXZYmi1,WXZYmi2,WXZYmi3,WXZYn,WXZYnn,WXZYp,WXZYq,WXZYss,WXZYv,WXZYw,WXZYy,WXZYro,WXZYolp,WXZYqn,WXZYqnbu,WXZYplt,WXZYagt,WXZYtz,WXZYti,WXZYsa,WXZYeb,WXZYrp,WXZYrpi1,WXZYrpi2,WXZYrpi3,WXZYrpi4,WXZYrpi5,WXZYppa,WXZYffd,WXZYorgo,WXZYorgsin,WXZYorgsti,WXZYul,WXZYkou,WXZYffreunloadd,WXZYffadd,WXZYfcsr,WXZYfcsrz;var WXZY_ams_onload_i=0;var WXZY_ams_onload=new Array();var WXZY_ams_onunload_i=0;var WXZY_ams_onunload=new Array();var WXZYsod=new Array();for(var WXZYvin="";WXZYvin!="aaaaaaaaaaaaaaaaaaaa";WXZYvin+="a")eval("var AdMch"+WXZYvin+";");var WXZYclct=0;var WXZYpc=new Array();WXZYk=1;WXZYd=1;WXZYw=0;WXZYy=0;WXZYro=0;WXZYi="";WXZYtz=0;WXZYti=0;WXZYrp=0;WXZYkou=1;var WXZYpmx=new Array('.gov/funzone/','.passport.net/panehelp.','/apps/mediaplayer/','/online/popup.html?','/playradionow.jsp?','/private.php?','/privmsg.php?','/radio/launchradio.','/reviews_viewer.php?object=','/site/olspage.jsp?id=','/spurl.php?v=','/video/partners/','/vspot/player.','/watch_fullscreen?','isapi.dll?picture','launch.yahoo.*/play/','music.yahoo.','skinbase.org/files/','webmail.aol.com','webmessenger.msn.com');WXZYorgo=open;WXZYorgsti=setTimeout;WXZYorgsin=setInterval;WXZYx();if(WXZYk)WXZYtry("window.onerror=WXZYj;");var WXZYz;WXZYtry("WXZYz=document.referrer");if(!WXZYz){if(WXZYti){if(WXZYtz)WXZYz=location.protocol+"//"+location.host+"/";else WXZYz="http://www.admuncher.com/";};}else if(WXZYz.substring(0,7)=="http://"){WXZYsa=WXZYz;WXZYsa=WXZYsa.substring(7,1024);if(WXZYsa.indexOf("/")!=-1)WXZYsa=WXZYsa.substring(0,WXZYsa.indexOf("/"));if(WXZYsa!=location.host){if(WXZYtz)WXZYz=location.protocol+"//"+location.host+"/";else WXZYz="http://www.admuncher.com/";};};
};
// End Ad Muncher helper script
// ]]>

//+------------------------------------------------------------------+
//|                                                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 = "";
   }
}

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      