[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 565

 
TEXX:

Good afternoon.

Order modification works partially, help me to figure out what the problem is.

Code and log attached. I have written in the log what works and what doesn't.....


Probably because of this.

        if (OrderOpenPrice()==!LastSellPrice()) sell_sl = 0;
        if (OrderOpenPrice()==LastSellPrice()) sell_sl = last_sell_sl;

The second condition will almost never work

 
Vinin:


Probably because of this.

The second condition will almost never be met


How do you make it work?
 
TEXX:

but how do you make it work?

Look up the topic with a search - something like how to compare two numbers of type double...
 
Roman.:

Look up the topic in the search - something like how to compare two numbers of type double...


Opening price normalisation has helped, but the condition on zero and non-zero stop.... does not work

THANK YOU all!!! Sorted it out, my hands are just wrong, I wrote != wrong and that's the reason for all the problems.

 

Can you tell me how to find out the total profit of all open orders?

OPS: Sorry, French sickness - nonscholarly...

AccountProfit()

 

Gentlemen MQL connoisseurs, could you tell me if it is technically possible to do the following?

- We take 100 (or any other number of) pieces of the quotes history from the past - pick them according to some known principle;

- Model an open buy position on those 100 pieces and enumerate Take Profit and Stop Loss so that the total profit is a normal one (i.e. we make a fitting on 100 separate pieces of history so that only one order works on each piece, so we have 100 orders in total), then do the same for the sell position, with enumerating of take and stop that maximizes the profit;

- we open a real trade - buy or sell, with a take and a stop, selected on the history.

And all this is within the framework of the Expert Advisor.

The trick is in picking up not on one continuous piece of history, but on a set of separate ones, and we do it every time after closing a position before opening a new one. I've really been thinking about how to do it logically, but I don't know how to do it technically using MQL.

 
alexeymosc:

Gentlemen of MQL, could you tell me if it is technically possible to do the following?

- We take 100 (or any other number of) pieces of the quotes history from the past - pick them according to some known principle;

- Model an open buy position on those 100 pieces and enumerate Take Profit and Stop Loss so that the total profit is a normal one (i.e. we make a fitting on 100 separate pieces of history so that only one order works on each piece, so we have 100 orders in total), then do the same for the sell position, with enumerating of take and stop that maximizes the profit;

- we open a real trade - buy or sell, with a take and a stop, selected on the history.

And all this is within the framework of the Expert Advisor.

The trick is in picking up not on one continuous piece of history, but on a set of separate ones, and we do it every time after closing a position before opening a new one. I've really been thinking about how to do it logically, but I don't know how to do it technically using MQL.

On the ZigZag fractures. The point is that the fractures alternate one by one, i.e. upward-moving, downward-moving, upward-moving, etc.
 
The EA needs a beep when all orders are closed, please help fix this one or give me another working version.

Thank you.

//-----
  static bool First = true;
  static int PreOrdersTotal = 0;
  int NowOrdersTotal = CountTrades();
  if(First)
  {
    PreOrdersTotal = NowOrdersTotal;
    First = false;
    return(0);
  }
  if(UseSound == true && NowOrdersTotal < PreOrdersTotal) {PlaySound(CloseSound);}
  PreOrdersTotal = NowOrdersTotal;
//-----

 
rustein:
The EA needs a beep when all orders are closed, please help fix this one or give another working version.

Thank you.


How to help you if

- do not know what the CountTrades() function returns;

- we don't know what the CloseSound variable contains;

- it's not known if there is a file whose name (theoretically) is contained in CloseSound.

 
rustein:
The EA needs a beep when all orders are closed, please help fix this one or give another working version.

Thank you.


if (OrdersTotal() == 0) {
  if (UseSound)  {
     PlaySound(CloseSound);
   }
   UseSound = false;
} else {
   UseSound = true;
}
Reason: