I need help, this is a very basic question, but... I'm not a coder, but I'm trying to code an EA for the first time,
So, I need to know how to close all trades based on MagicNumber variable...
I want to put an order but before close all open trades of that EA. Is this possible?
Thanks!An easy task my friend kokas:
1- Go to: http://www.metatrader.info/node/158
2- Download the Close All purposes script.
3- Set the optionparameter to close by the magic number. (Note: You have to set the magic_number variable)
4- Show me your smile!
eheheheh let me try this... I'm a little rusty in programming... But I want to learn MQL Your lessons are precious!
Hi again... still nothing... Hope you read my private message
u may can put something like this before your order
this isnt tested so i dont know if syntax is 100%
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic) {
OrderClose(OrderTicket(), OrderLots(), Bid, 100, Red);
} }}}
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
if (OrderMagicNumber()==Magic) {
OrderClose(OrderTicket(), OrderLots(), Bid, 100, Red);
This was only the beginign of my problems... lolol
been there done that
whut else is hanging you up?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I need help, this is a very basic question, but... I'm not a coder, but I'm trying to code an EA for the first time,
So, I need to know how to close all trades based on MagicNumber variable...
I want to put an order but before close all open trades of that EA. Is this possible?
Thanks!