![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Ilan, est-ce que ce genre de codage peut vous aider?
It's still very confusing why you would need to randomize your magic numbers. If you think it will trick the broker then that's not going to accomplish your goal. Your broker doesn't care what magic number is they only care whether an account is on book A or book B, and if it were really that easy to trick the dumb brokers we'd all be baiting them with fake stops to get better fills. If you want to manage a pool of orders by date just use the date. Magic numbers were implemented in order to create a unique ID so mql programs can know which orders to manage. In summary, randomizing magic numbers to fool the broker won't work/matter so use the date and avoid the inevitable errors you will introduce...
I agree with you, that trying to trick the broker by changing magic numbers won't work. However, I know some people might disagree with us. I was trying to include an option for someone where I can say "ok, you think brokers may track by magic number, and you don't like that. so here is an option to prevent that."
That little nugget came into my mind, and I wanted to see if I could tackle the issue. I found a way to make it 'work'. If I only call rand() right after seeding with a constant seed, it returns the same number every time. So using the day+month from OrderOpenTime()as the seed will return the magic number that I used from that same day. But I see I've been trying to solve an imaginary problem, though. I guess it just turned into a puzzle for me that I had to crack, rather than trying to find effective code. What I was trying to do would probably also cause problems for people that were trying to use another EA to interact with orderhistory for example. Thank you for your help.
That is because you refused to answer the question "why do you think you need a random number." That answer is your true issue. I answered your question (#3) that you do not want random MNs (which you ignored,) and others also asked (which you refuse to answer, and insist on your way.)
If you use any random sequence, then on a terminal restart, you will have a new MN and loose connection with any open orders. #6 is wrong the moment you hold an order overnight . All you've done is alienate those trying to help you and your "solution" will cost you.
Yes, you are right. Thank you for posting the link earlier. I've been studying what you said, and I think building an array of magic numbers for the different strategies using a similar method to the one you posted may work best
sdfgdfg
Ilan, est-ce que ce genre de codage peut vous aider?
Je vais probablement utiliser ceci:
Je vais probablement utiliser ceci:
I agree with you, that trying to trick the broker by changing magic numbers won't work. However, I know some people might disagree with us. I was trying to include an option for someone where I can say "ok, you think brokers may track by magic number, and you don't like that. so here is an option to prevent that."
...