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

 
FAQ:
Not in the bathhouse, so cache cleaner

I see. Thank you.
 

Professionals, help. I've inserted a function in the indicator to send messages to the mail.

Can't compile it. Please tell me what I did wrong. I am just beginning to understand the code.

Files:
vininmail.mq4  5 kb
 

Can you tell me why the script does not delete all orders, 3 buylimit orders are open and one buy market order.

for(i = 0; i < OrdersTotal(); i++)
                {
                if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == FALSE) break;
                if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
                        {
                        Print(i);
                        if(OrderType() == OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,Slippage);
                        if(OrderType() == OP_SELL) OrderClose(OrderTicket(),OrderLots(),Ask,Slippage);
                        if(OrderType() == OP_BUYSTOP) OrderDelete(OrderTicket());
                        if(OrderType() == OP_SELLSTOP) OrderDelete(OrderTicket());
                        }
                }
 
sss2019:

Can you tell me why the script does not delete all orders, 3 buylimit orders are open and one buy market order.

Because in MT4 there is one trade flow and only one trade order can be given at a time. After each order you need to make sure that the trade flow is not busy.
 
sss2019:

Can you tell me why the script does not delete all orders, 3 buylimit orders are open and one buy market order.


Reshetov:
Because in MT4 the trade flow is one and only one trade order can be given at a time. After each order, you need to make sure that the trade flow is not busy.

no


The problem here is simply in the loop. i goes through i from 0 to 2. You need 2 to 0.

 
Hello! Please advise how you can make the orders open in turn for example in the beginning OP_BUY when it will be closed and there will be a signal to open OP_SELL and it closes with a buy signal OP_BUY opens, etc...!
 
lowech:
Hello! Tell me how you can make the orders open one by one, for example, in the beginning of OP_BUY, when it is closed and there is a signal to open OP_SELL, and it is closed with a buy signal opens OP_BUY, etc...!

It's very easy to solve with semaphores (bool).

You may think about it and it will work.

 
sss2019:

Can you tell me why the script does not delete all orders, 3 buylimit orders are open and one buy market order.

buylimit you want to delete but not select it (this type)
 
DhP:

It's very easy to solve with semaphores (bool).

Think about it and you will get it.

Thank you for pointing me in this direction!
 
Skydiver:
Please explain with an example.
There cannot be a system that makes 100% profitable trades. Systems with the maximum length of series of losing trades would be equal to 1, also can not be. In a pure martin the lots are varied by the principle: 1-2-4-8-16-, etc. Loss, in this case, increases on the principle: 1-3-7-15- etc.

Take any system, suppose the system with fixed lots = 1, gives a series of PPUUUUPU. Where, P is profit and U is loss. As a result, you get an increase in loss according to the principle: 1-2-3-4-5-. How is it better than martingale? Only that the loss does not increase as much as in the case of martingale. Otherwise, it's the same as Natasha, only in different shorts.