Time: 2017-05-18 | Download file:Parse_AlterTrader_v01.mq4
//============================================================================= // GrabNewsFF.mq4 - hacked up! // Copyright © 2006, Derk Wehler // Code derieved from original by: Copyright © 2006, Abhi // (SCRIPT) //============================================================================= #property copyright "Copyright © 2006, Derk Wehler" #property link "no site" // // Ron hacked this up so it can grab // data from AlterTrader // #include// it's the symbol + "clo" to get other data string myUrl = "http://www.altertrader.com/GBPUSDclo.html"; string Outputfile = "altertrade.txt"; int beginning=1; int start() { int handle; int finalend; int end; int i; string sData; string xprice,xpct; int size; int endcheck; GrabWeb(myUrl, sData); finalend=StringLen(sData); // let's parse it now and write to csv file handle = FileOpen(Outputfile,FILE_CSV|FILE_WRITE,","); FileWrite(handle,"Price","Percent"); while (beginning < finalend) { // Handle PRICE beginning = StringFind(sData,"align=\"center\">",beginning)+15; end = StringFind(sData,"<",beginning); //Print("1 B="+beginning+" E="+end); if ((end-beginning)>0) { xprice = StringSubstr(sData,beginning,end-beginning); } // Handle PERCENT beginning = StringFind(sData,"align=\"center\">",beginning)+15; end = StringFind(sData,"<",beginning); //Print("2 B="+beginning+" E="+end); if ((end-beginning)>0) { xpct = StringSubstr(sData,beginning,end-beginning); } FileWrite(handle,xprice+","+xpct); // are we out of data? endcheck = StringFind(sData," ", beginning); if(endcheck<0) break; beginning=endcheck; } FileClose(handle); Print("-----Parse complete-----"); } Recommend