//+------------------------------------------------------------------+ //| Loop test.mq4 | //| Copyright © 2011, TradeForex | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2011, TradeForex" #property link "" //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ extern bool Use_Semafor = true; extern int Lookback = 80; extern int buffer_no = 5; int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- if (Use_Semafor) { double highest = 0; int found = 0; double val; for (int y = 0; y <= Lookback;y++) { val = iCustom(NULL,0,"#4X 3 Semafor Alert",5,12,35,2,"5,3","5,3","5,3",159,159,82,buffer_no,y); if (val > 0) { // Alternate line of code can be removed if no value returns 0 from iCustom if (val < 10000) // assumes a good value is never above 10000 { if (val > highest) highest = val; found++; // Count how many values are found } } if (found == 2) break; // end the loop } Comment ( "", "\n", "Value ", val ); } //---- return(0); } //+------------------------------------------------------------------+