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

 
No, I'm writing an advisor, with a virtual trawl... )

If I count the size of open orders separately and divide it by the number of orders, would it be correct? It would be the same for profit orders.

(Thank you.

 
rustein:
Thank you, please tell me how to calculate the total profit in pips for all open orders. What shall we correct?


Using OrderProfit() we calculate in the currency of deposit

To calculate in pips, the models for open and closed orders are slightly different

for open orders

double ProfitPoint(){
    int total=OrdersTotals();
    double profit=0;
    for (int pos=0;pos<total;pos++) {
    OrderSelect(......);
    if (myOrder()) { // выбор своего ордера или нужного (варианты на ваше усмотрение
       if (OrderType()==OP_BUY){
          profit+=(Bid-orderOpenPrice())/Point;
       } else if (OrderType()==OP_SELL) {
          profit+=(orderOpenPrice()-Ask)/Point;
       }
    }
    return(profit);
}

Something like this

 
rustein:
No, I'm writing an advisor, with a virtual trawl... )

If I count the size of open orders separately and divide it by the number of orders, would it be correct? It would be the same for profit orders.

Thank you.

For a long position, the profit in pips is calculated as:

profit = (MarketInfo(OrderSymbol(), MODE_BID) - OrderOpenPrice()) / MarketInfo(OrderSymbol(), MODE_POINT);

For short positions it is calculated as follows:

profit = (OrderOpenPrice() - MarketInfo(OrderSymbol(), MODE_ASK)) / MarketInfo(OrderSymbol(), MODE_POINT);
 
Vinin:


Using OrderProfit(), we calculate in the deposit currency

To calculate in pips, the models for open and closed orders are slightly different

For open orders

Something like this

double ProfitPoint(){
    int total=OrdersTotals();
    double profit=0;
    for (int pos=0;pos<total;pos++) {
    OrderSelect(......);
    if (myOrder()) { // выбор своего ордера или нужного (варианты на ваше усмотрение
       if (OrderType()==OP_BUY){
          profit+=(Bid-orderOpenPrice())/Point;
       } else if (OrderType()==OP_SELL) {
          profit+=(orderOpenPrice()-Ask)/Point;
       }
    }
    return(profit);
}
Only if all the poses are on the same instrument, then you can do that.
 
Reshetov:
Only if all the poses are on the same instrument, then you can do that.

Agreed
 
Thank you and thank you again! Got it all.
 

Gentlemen - a little help...

I'm really confused by this question - how do I translate the commission of an order into pips?

 
sergeev:

I recommend that you do this via Comment.

RekkeR:

h ttps://www.mql5.com/ru/code/10558
Author, busy as hell, maybe someone can simplify the machine.

https://www.mql5.com/ru/forum/136747/page506

Roman. 06.01.2012 16:13
That had to go a little earlier to Alex Sergeev's turn, when before the New Year somewhere here created a thread with his suggestions for finalizing any of the interested forum member ideas, tools, templates, and, incidentally, speaking, there in the FIRST turn from it was just about such interactive gizmos, about his willingness to complete them ... Look for it or see it a few pages later, you'll find it (this thread) has gone a bit to page 5 already ... :-)

P.S. Maybe it's not too late to ask him about it...

??? About late.

 
not late, but a suggestion for MT5.
 
elmucon:

Gentlemen - a little help...

I'm really confused by this question - how do I translate the commission of an order into pips?


I have no idea what to do with the order, but I'd rather use its lot.
Reason: