[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 358

 
Chiripaha:

This parameter is responsible for the colour of the deletion arrow https://docs.mql4.com/ru/trading/OrderDelete - You can remove it (the parameter) from there altogether, then the arrow will not just appear. And if you really need an arrow, you'd better re-read the Types of Variables section of the book.

By the way, I'm the same not particularly sophisticated in coding (some people call it programming, not distinguishing between these concepts - but it's coding). And so did getting into reference books and looking up what these things are. Chew on reference books and textbooks more often. As a rule, most issues are covered there. - Everyone does this, even experienced ones, as you can't memorise everything. These are all reference materials.

clDelete - as you may guess, cl is colour, Delete is deletion. The colour of deletion.


Thanks a lot for the reply.I have already deleted the clDelete variable

void DeleteOrders(string sy="", int op=-1, int mn=-1) {
  int i, k=OrdersTotal(), ot;
  
  if (sy=="") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      ot=OrderType();
      if (ot==OP_SELLSTOP) {
        if (OrderSymbol()==sy && (op<0 || ot==op)) {
          if (mn<0 || OrderMagicNumber()==mn) 
          {
          OrderDelete(OrderTicket());
          }

But in this case the compiler generates another error.

'DeleteOrders' - function returns no result C:\Program Files\Alpari NZ MT4\experts/delete.mq4 (68, 5)

How to fix it.


 
solnce600:

Good afternoon everyone!

I am trying to use the function to delete ALL pending orders in the tester from Kim's functions

When I try to compile it, I get an error saying that the ' clDelete ' variable is not defined.

'clDelete' - variable not defined C:\Program Files\Alpari NZ MT4\experts\Positive.mq4 (94, 38)

Please tell me - how and where it should be defined?

Thank you.

First, reverse the loop:

    for (i = k - 1; i <= 0; i--)

and give the OrderDelete() function what it wants.

 
TarasBY:

Array enumeration:

- If I understand your "wants" correctly.

Igor, thank you very much!

As I understand it, there is no special function, so it has to be brute force.

 
Chiripaha:

Igor, thank you very much!

As I understand it, there's no special function, so it has to be overkill.

There is no standard function.
 
solnce600: 'DeleteOrders' - function returns no result C:\Program Files\Alpari NZ MT4\experts\Orders.mq4 (68, 5)

Your function (self-written) DeleteOrders() returns NOTHING! Look in your code - how you call it.
 

Thank you very much for your prompt reply.

The loop has been deployed.

Now it generates another error

DeleteOrders' - function returns no result

And what else does the OrderDelete(OrderTicket()) function need as a passed parameter except OrderTicket() and apart from the arrow colour (which I don't need)?

void DeleteOrders(string sy="", int op=-1, int mn=-1) {
  int i, k=OrdersTotal(), ot;
  
  if (sy=="") sy=Symbol();
   for (i = k - 1; i <= 0; i--) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      ot=OrderType();
      if (ot==OP_SELLSTOP) {
        if (OrderSymbol()==sy && (op<0 || ot==op)) {
          if (mn<0 || OrderMagicNumber()==mn) 
          {
          OrderDelete(OrderTicket());
 
TarasBY:
Your (self-written) DeleteOrders() function returns NOTHING! Look at your code - how you call it.
I.e. there should be TRUE or FALSE lines at the end of your custom function code?
 
TarasBY:
Your (self-written) function DeleteOrders() returns NOTHING! Look in your code - how you call it.

Inserted lines at the end of the function code that return true

Changed the function call

R = DeleteOrders(true);
if(R ==true )

Ticket=OrderSend(Symbol(),OP_SELLSTOP,0.1,iHigh( Symbol (), 0,1)-1500*Point,1,iHigh( Symbol (), 0,1),iHigh( Symbol (), 0,1)-1610*Point, "jfh",123 );//ENA
//Ticket=OrderSend(Symbol(),OP_SELLSTOP,0.1,iHigh( Symbol (), 0,1)-1000*Point,1,iHigh( Symbol (), 0,1)+330*Point,iHigh( Symbol (), 0,1)-1100*Point, "jfh",123 );//ENA
if (Ticket>0)
X=iHigh( Symbol (), 0,1);
if (OrderSelect (ot-1,SELECT_BY_POS)
if ( OrderType ()==OP_SELLSTOP)
DT = OrderOpenTime ();

}
}

return(0);

void DeleteOrders(string sy="", int op=-1, int mn=-1) {
int i, k=OrdersTotal(), ot;

if (sy=="") sy=Symbol();
for (i = k - 1; i <= 0; i--) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
ot=OrderType();
if (ot==OP_SELLSTOP) {
if (OrderSymbol()==sy && (op<0 || ot==op)) {
if (mn<0 || OrderMagicNumber()==mn)
{
int W = OrderDelete(OrderTicket());
if (W==true)
return(true);

Returns the same error.

'DeleteOrders' - function returns no result

Could you please tell me what is my error.

Thank you.

 
solnce600:

Inserted lines at the end of the function code that return true

Changed the function call

R = DeleteOrders(true);
if(R ==true )

The function type was forgotten:

void bool DeleteOrders (string sy="", int op=-1, int mn=-1)
 
TarasBY:

The type of function is forgotten:

All OK!!! Thank you very much!!!