Hello community,
When making a robot, is it possible to program a robot in such a way that it can determine FIFO for positions of the same size and instrument in the same account?
If, for example, I have 7 positions of the same size and instrument in one account, with seven robots on seven screens, and a robot tries to send a signal to close, can it be programmed to discern which position was taken first, and close the same at market?
I set my Magic Number to zero for my robots, which does mostly work, but should the market move quickly, 2 or 3 robots can send a trade signal to close a position at the same time. I'll get a FIFO violation, and the trade will not execute, or will close late.
Any suggestions?
Yes, it is possible but its complex. Also, you should not use the magic number "0" for EAs as that is reserved for manual trades.
Really I am curious to know how it's possible ?
EA 1 open a trade. EA 2 open a trade. Same symbol and direction of course.
EA 2 want to close his trade, he can't by FIFO rules. How could you possibly manage that even in a "complex" way ? And of course without multiplying the open/close with a spread each time (as of course you can close EA1 trade, then EA2 trade, then open EA1 trade again, which is not a solution in my opinion).

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello community,
When making a robot, is it possible to program a robot in such a way that it can determine FIFO for positions of the same size and instrument in the same account?
If, for example, I have 7 positions of the same size and instrument in one account, with seven robots on seven screens, and a robot tries to send a signal to close, can it be programmed to discern which position was taken first, and close the same at market?
I set my Magic Number to zero for my robots, which does mostly work, but should the market move quickly, 2 or 3 robots can send a trade signal to close a position at the same time. I'll get a FIFO violation, and the trade will not execute, or will close late.
Any suggestions?