- MQL5 Wizard: Development of trading robots for MetaTrader 5
- MetaEditor - Professional editor of trading applications
- Algorithmic (automated) trading in MetaTrader 5
Hello, grab a string of length 13:
Look here for "every combination": https://www.mql5.com/en/code/25724
For wirting to a file use
this:
https://www.mql5.com/en/articles/2720#add2
- www.mql5.com
Hello, grab a string of length 13:
Hello,
try this..
StringSubstr(IntegerToString(1111000011110),4,(13-4))
or
StringSubstr(IntegerToString(1111000011110),4,9)
Hello,
try this..
or
Do you really expect an answer? We can't see your broken code. There are no mind readers here and our crystal balls are cracked.
This is how far i have go, it does all permutations of 4 but some are repeated and it doesnt stops on only 4 of length it goes to 1 2 3 sequence lengths, im still trying to figure out for permutations from 5-13 also without repetitions of substrings { //--- // test 1 string test1= "test1.csv"; int handle= FileOpen(test1,FILE_CSV|FILE_READ|FILE_WRITE,';'); string test; int a= 0,sub= 0; while(100>a) { test= StringSubstr(IntegerToString(1111000011110),0+sub,4); FileWrite(handle,test+"\t"); sub++; a++; } Print(handle); FileClose(handle); //--- return value of prev_calculated for next call return(rates_total); }
There's no need to see my code, if you go to the original question to answer... How to code all permutations of substrings of length 4-13 from a binary sequence of 13?
Wrong. You should show your code. The problem would likely to be found quickly. Your asking people to create a solution for you without even giving us your attempt. I can spend a few minutes finding the fault in your code, but I don't have an hour to write something from the beginning. And there would be 500 people here just like that.
In the words of Jerry Maguire "help me help you"
Wrong. You should show your code. The problem would likely to be found quickly. Your asking people to create a solution for you without even giving us your attempt. I can spend a few minutes finding the fault in your code, but I don't have an hour to write something from the beginning. And there would be 500 people here just like that.
In the words of Jerry Maguire "help me help you"
I posted my code fyi
Nothing will ensure that your substrings are unique when you simply do a StringSubString() and FileWrite() immediately after.
Look into some data structures (e.g. arrays) to store your substrings - organize them so that it's easy to compare each new substring with already extracted ones to make sure they are unique, before writing to file.
- docs.mql4.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use