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
No, they can be anything you want. just like the comment. see them as some sort of a numerical comment. All manual trades opened with the normal MT4 user interface will have the magic number 0, so you can for example loop over all orders and close/delete all manual trades and orders while leaving all EA trades untouched.
For uniquely identifying only one certain order there is the ticket number.
thank you for clearing that up & sharing your views. Fwiw, I learned a lot..
I don't need MathPow(), why didn't anybody see this?
updating the first posting now.
I don't need MathPow(), why didn't anybody see this?
Three main reasons spring to mind:
I wouldn't say it reduces the clarity. My main intention is clarity and elegance and accuracy, not performance.
I could also use power, multiplication, division (and modulo) to do the actual bit shifting without using any bitwise operators at all. But for the sake of elegance (and also clarity) i should do it either exclusively with one or the other, but not mixed. And since the meaning of the function is to shift bits around I would only obfuscate the code if i did bit shifts with multiplications.
Also while addition and multiplication may be done with integers the MathPow() function internally uses logarithms, smells like approximation and is incredibly complex compared to what i need it for, it uses and returns a double value and this has nothing to do in an integer function that should only shift n bits.
Maybe I should have asked the question why didn't I see this. Why did I use MathPow() in the first place? I don't know it. The last time I did some assembler was 15 years ago, today I'm used to think about problems in higher abstractions. Maybe this was the reason. Somewhere in my brain there is a strong connection with the nth bit being 2^n, I just wrote this down without thinking a second about it. An assembler programmer never would have done this. Shifting left is multiplying by 2, multiplying by 2 is shifting left.
My solution for persistence is to use the 32 bits of the int to hold the tf's I use(10 of them), the expert version or trade method that opened the order(i have 4 of those). Still many bits to spare if i needed. I use the bitwise operations and some conversion functions to handle this. I know others do this or something similar, but since this doesn't seem to be enough for your situations, i'm still trying to wrap my head around the question I asked.
How would in your example the Symbol() become part of the MN? You have an EA number and a Timeframe number, but what about the symbol?
I can see the advantages of your approach and may utilize it at some point in the future. But being a NuB I am utilizing MM from the code base in MQL4.Com. So at this point in my programing learning curve, MM is not my priority. Though if I can find a better method that I can splice in I will until such time that MM gets to the top of my priority list I'm not opposed to using it. Us NuBs need all of the help that we can get!
In regards to the name &/or version number, the MN only allows numbers and not letters.
I didn't go through your code but I'm assuming that your algorithm is converting the name to part of your MN in which case it would not immediately tell you of which currency pair you are addressing.
your algorithm is converting the name to part of your MN in which case it would not immediately tell you of which currency pair you are addressing.
It will reliably convert any string into a unique integer number. This conversion is a one-way street, but I never ever need to convert it back.
All I need to know is that these trades with the same number belong together. It is just an ID number to easily find all the trades of this specific EA/symbol/TF combination with just one single if() in the loop. The only thing that has to be known about this number is that it is unique for each EA/symbol/timeframe combination and that it is deterministic and will not change if my PC decides to crash.
All trades logically belonging together will have the same MN. If i ever at some later time need to tell on which symbol they were made (for example to do some statistics at the end of the month) I can simply use OrderSymbol() on these orders.
Hey guys, just curious why you'd need more than one expert running the same tf, and symbol with same settings?
My solution for persistence is to use the 32 bits of the int to hold the tf's I use(10 of them), the expert version or trade method that opened the order(i have 4 of those). Still many bits to spare if i needed. I use the bitwise operations and some conversion functions to handle this. I know others do this or something similar, but since this doesn't seem to be enough for your situations, i'm still trying to wrap my head around the question I asked.
I can't speak for anyone else, but I have an EA that can take awhile to close an order, and it misses new entry points because it's still not closed from the previous order. I would like for it to handle each entry independently and follow each trade according to the rules of each trade (moving sl, close half when tp first reached, etc).
I can't speak for anyone else, but I have an EA that can take awhile to close an order, and it misses new entry points because it's still not closed from the previous order. I would like for it to handle each entry independently and follow each trade according to the rules of each trade (moving sl, close half when tp first reached, etc).I see. So it's tied up waiting on the server response, and meanwhile you could be opening other orders?
But, doesn't the trade context being busy stop any order related actions?
I guess as long as it works, that's all that really matters.
Not so much server response, but just having an order open. So the EA might get a buy signal and buy, and then stay open. A few hours later another buy signal comes, but since the already has an open position, it doesn't buy because it's waiting to close the first order. But there's no reason to assume the first buy signal will be more profitable than the second or the that there's anything to be gained by waiting for the first to close out before allowing the EA to open additional orders. But I'm still working on it, so for me it's still theory. :)