this thread maybe interest curriencies list
please if possible, u make implement in code and happy all done, could u post here ur findings/func() used?
data hiding and data finding seems hard at times in mt, hope hear from u
Best
fbj: data hiding and data finding seems hard at times in mt,
Hide and seek:string brokerSymbols[]; int nSymbols = FindSymbols(brokerSymbols); if (nSymbols <= 0) return; :See also the script AllMarketData that comes with mt4.
int FindSymbols(string& symbols[]){ // Get list of all tradeable pairs. #define FNAME "symbols.raw" int handle=FileOpenHistory(FNAME, FILE_BIN | FILE_READ); if(handle<1){ DisableTrading( "Unable to open file"+FNAME+", error: "+GetLastError()); return(0); } #define RAW_RECORD_SIZE 1936 #define RAW_SYMBOL_SIZE 12 // #define RAW_DESCR_SIZE 75 #define RAW_SKIP_DESCR 1924 // 1936-12 // #define RAW_SKIP_REMAN 1849 // 1936-12-75 int nRecords=FileSize(handle) / RAW_RECORD_SIZE; if(ArrayResize(symbols, nRecords) <= 0){ DisableTrading( "ArrayResize(Symbols, "+nRecords+") Failed: " + GetLastError() ); FileClose(handle); return(0); } for(int iRec=0; iRec < nRecords; iRec++){ // "AUDCAD<NUL><NUL><NUL><NUL><NUL><NUL>" symbols[iRec] = FileReadString(handle, RAW_SYMBOL_SIZE); FileSeek(handle, RAW_SKIP_DESCR, SEEK_CUR); // goto the next record // "Auzzie Dollar vs. Canadian Dollar<NUL><NUL><NUL>..." // dsc[nRec] = FileReadString(handle, 75); // FileSeek(handle, RAW_SKIP_REMAN, SEEK_CUR); // goto the next record } FileClose(handle); return(nRecords); } // FindSymbols
And there should be static record that file ".raw" is opened, there is limit for 32 or it's not?
FileClose(handle);
It did not work for me, even if I used
FileClose(handle);
so I've put counter to count with the file closing how many times I can repeat it. It looks like to that there is limit of 32 times to be opened the ".raw", or the other thought was that FileClose(handle); maybe have no effect on that exact for symbols. But in both cases it is not a problem, symbols (for me) are needed to be read once, it was just a test.
If I missed the code to put it:
/*without searching from file.txt*/ int loadSymbols() { if(a>0) return(size);//previous was counter here i.e. removed a=FileOpenHistory("symbols.raw",FILE_BIN|FILE_READ); if(a<1) return(-1); size=0; string tmps; int o=FileSize(a) / 1936; for(int c=0;c<o;c++) { tmps=FileReadString(a,12); FileSeek(a,1924,SEEK_CUR); if(symCheck(tmps)!=0) continue;/*if valid, mi[27] 0=Forex, if we want only forex */ //if(symDoub(tmps)) continue;//if already loaded similar or exact size++; ArrayResize(sym,size); sym[size-1]=tmps; } FileClose(a);//actialy not needed because it'll not work as counter return(size); } /***/ int symCheck(string cstr) { if(symInfo(cstr)) return(-3); if(mi[27]>-1.0 && mi[27]<1.0) return(0); if(mi[27]>0.0 && mi[27]<2.0) return(1); if(mi[27]>1.0 && mi[27]<3.0) return(2); return(-2); }
rfb: It did not work for me, even if I used
Don't install in \program files* on Vista/Win7
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm working on a project that loops through an array of all available pairs. Currently I hardcode this, but this is obviously not good programming practice. Is there a way to do this dynamically?
Thanks, Mango