eugggy: I'm not asking you to write me an EA, I originally asked for a couple of lines about closing, if it's not difficult, respectively if it's difficult, then don't. What is the problem?
Well, it's not a couple of lines, it's a couple of functions. Three functions, to be exact. Each one does its own thing.
eugggy: Well, just say there's no time, I don't know how many lines such a block would take. Anyway, thanks for the tips, I'll try to make something up myself.
That's what I said I'd do tomorrow. Why be offended?
eugggy: Well, just say there's no time, I don't know how many lines such a block would take. Anyway, thanks for the tips, I'll try to make something up myself.
Judging by the code presented and then deleted, it's already screwed up.
eugggy: Do you think we were surprised? - No. There's nothing to see in it, I told you, all I need is removal.
// check for open orders int n=0; // number of open orders for (int i=OrdersTotal()-1; i>=0; i--) { if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break; if(OrderType()==OP_BUYSTOP) n++; if(OrderType()==OP_SELLSTOP) n++; } if(n>0 && n<OrdersTotal()) // check for pending orders if open for (i=OrdersTotal()-1; i>=0; i--) // delete pending orders { if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break; if(OrderType()==OP_BUYSTOP) OrderDelete(OrderTicket()); if(OrderType()==OP_SELLSTOP) OrderDelete(OrderTicket()) if(OrderType()==OP_BUYLIMIT) OrderDelete(OrderTicket()); if(OrderType()==OP_SELLLIMIT) OrderDelete(OrderTicket()); }
Code in first approximation. Further it is modified, simplified and made more complicated by the task. There are a lot of approaches.
eugggy: Well, just say there's no time, I don't know how many lines such a block would take. Anyway, thanks for the tips, I'll try to make something up myself.
Gohere. You will learn from Igor Kim who has done everything for you. You may learn a lot and find a ready-made code for yourself. When you're good at it, you'll be able to write everything yourself. I highly recommend it to start with.
artmedia70: Gohere. It's a long time since Igor Kim did all the work for you. You'll learn a lot and find ready-made code for yourself. When you're good at it, you'll be able to write everything yourself. I highly recommend it to start with.
That's a good idea... I did it too, when I started mastering the language...
Well, for those who know what c++ is, it might be awesome, but for me it's a bit complicated:) It's not even about all those functions and operands, it's about the way they're spoken: nobody talks like that nowadays, so it's harder to understand. Example: "as a result of operator execution" is already stressing me out, why not say "when the operator is executed". So I'd say the textbook is written with an A.
Yeah, they talk like that nowadays, it would make Ellochka the Ogre. Pay attention to the examples, i.e. program codes, their completeness, simplicity, brevity. If you have problems with the basics of programming, in my opinion, the best textbook is the 1986 high school textbook on computer science.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I'm not asking you to write me an EA, I originally asked for a couple of lines about closing, if it's not difficult, respectively if it's difficult, then don't. What is the problem?
Well, it's not a couple of lines, it's a couple of functions. Three functions, to be exact. Each one does its own thing.
Each function has a minimum of five lines.
Well, just say there's no time, I don't know how many lines such a block would take. Anyway, thanks for the tips, I'll try to make something up myself.
That's what I said I'd do tomorrow. Why be offended?
Well, just say there's no time, I don't know how many lines such a block would take. Anyway, thanks for the tips, I'll try to make something up myself.
Judging by the code presented and then deleted, it's already screwed up.
Do you think we were surprised? - No. There's nothing to see in it, I told you, all I need is removal.
// check for open orders
int n=0; // number of open orders
for (int i=OrdersTotal()-1; i>=0; i--)
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
if(OrderType()==OP_BUYSTOP) n++;
if(OrderType()==OP_SELLSTOP) n++;
}
if(n>0 && n<OrdersTotal()) // check for pending orders if open
for (i=OrdersTotal()-1; i>=0; i--) // delete pending orders
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
if(OrderType()==OP_BUYSTOP) OrderDelete(OrderTicket());
if(OrderType()==OP_SELLSTOP) OrderDelete(OrderTicket())
if(OrderType()==OP_BUYLIMIT) OrderDelete(OrderTicket());
if(OrderType()==OP_SELLLIMIT) OrderDelete(OrderTicket());
}
Code in first approximation. Further it is modified, simplified and made more complicated by the task. There are a lot of approaches.
Thanks, I'll give it a try.
No. You should write down in words what each line does in your code and you will see for yourself
Well, just say there's no time, I don't know how many lines such a block would take. Anyway, thanks for the tips, I'll try to make something up myself.
When you're good at it, you'll be able to write everything yourself.
I highly recommend it to start with.
Go here. It's a long time since Igor Kim did all the work for you. You'll learn a lot and find ready-made code for yourself.
When you're good at it, you'll be able to write everything yourself.
I highly recommend it to start with.
That's a very good point... I did it too when I started learning the language...
Everyone starts somewhere...
Yes, a lot of useful stuff. I could have done without the freebies, but the textbook is very intricately written.
Well, for those who know what c++ is, it might be awesome, but for me it's a bit complicated:) It's not even about all those functions and operands, it's about the way they're spoken: nobody talks like that nowadays, so it's harder to understand. Example: "as a result of operator execution" is already stressing me out, why not say "when the operator is executed". So I'd say the textbook is written with an A.
Yeah, they talk like that nowadays, it would make Ellochka the Ogre. Pay attention to the examples, i.e. program codes, their completeness, simplicity, brevity. If you have problems with the basics of programming, in my opinion, the best textbook is the 1986 high school textbook on computer science.