sum of positive open buy orders and sum of positive open sell orders

 

Hello everyone,,hope everyone doing well,,,

i need an indicator or tool to show me the ' sum of positive open buy orders and sum of positive open sell orders ' .

thank you.

 
FaridHooti:

Hello everyone,,hope everyone doing well,,,

i need an indicator or tool to show me the ' sum of positive open buy orders and sum of positive open sell orders ' .

thank you.

search codebase or marketplace or create a job on freelance for small fee.

This forum is mostly for asking questions regarding mt4/5 issues; and/or coding advice. 

There are many forums on the web where general discussion and requests are encouraged. This is not one of those.

 
FaridHootii need an indicator or tool to show me the ' sum of positive open buy orders and sum of positive open sell orders ' .
That would be nonsense.

Lots Weighted Average Price = ∑ op(i) × lot(i) ÷ ∑ lot(i) . This is the break even price of all orders combined. Use negative lots for sell orders.

 
FaridHooti:

Hello everyone,,hope everyone doing well,,,

i need an indicator or tool to show me the ' sum of positive open buy orders and sum of positive open sell orders ' .

thank you.

i think it is obvious that you did not do a search. see first link in search page. But there are several different indicators and eas on there that show the same thing. Next time do a search please.

https://www.mql5.com/en/search#!keyword=weighted%20price&module=mql5_module_codebase

 
FaridHooti:

Hello everyone,,hope everyone doing well,,,

i need an indicator or tool to show me the ' sum of positive open buy orders and sum of positive open sell orders ' .

thank you.

Use this function in your EA:

double PositiveFloat(int type)
{
   double result = 0;
   int total = OrdersTotal();
   double price = (type == OP_BUY)?Bid:Ask;
   for(int i=total-1; i>=0; i--)
   {
      if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
      if(OrderSymbol() != Symbol() || OrderType() != type) continue;
      if(OrderProfit()+OrderCommission()+OrderSwap() > 0 && MathAbs(price-OrderOpenPrice()) > 0)
      {
         result += OrderProfit()+OrderCommission()+OrderSwap();
      }   
   }
   return(result);
}
 
Michael Charles Schefe #:

i think it is obvious that you did not do a search. see first link in search page. But there are several different indicators and eas on there that show the same thing. Next time do a search please.

https://www.mql5.com/en/search#!keyword=weighted%20price&module=mql5_module_codebase

i did, and be polite
 
William Roeder #:
That would be nonsense.

Lots Weighted Average Price = ∑ op(i) × lot(i) ÷ ∑ lot(i) . This is the break even price of all orders combined. Use negative lots for sell orders.

if you didnt get it then dont answer
 
Sopheak Khlot #:

Use this function in your EA:

thank you but i just need the indicator and i am not good with working with codes
 
FaridHootiHello everyone,,hope everyone doing well,,, i need an indicator or tool to show me the ' sum of positive open buy orders and sum of positive open sell orders ' . thank you.

Here's an example for MT4:

Code Base

Opened positions indicator

Александр, 2009.11.23 13:41

It shows a brief information about all of the positions opened. It can be useful, if yours expert advisor trades many positions simultaneously.

 

The heavy guts of the calculation are:

Forum on trading, automated trading systems and testing trading strategies

How get position profit?

Morimil, 2020.06.22 11:31

This code is better

//+------------------------------------------------------------------+
//| TOTAL_PROFIT_OF_OPEN_POSITIONS                                   |
//+------------------------------------------------------------------+
double TOTAL_PROFIT_OF_OPEN_POSITIONS()
  {
   double Total_Profit=0;
   double deal_commission=0;
   for(int i=0; i<PositionsTotal(); i++)
     {
      ulong  position_ticket=PositionGetTicket(i);                      // ticket of the position
      ulong  magic=PositionGetInteger(POSITION_MAGIC);                  // MagicNumber of the position
      string comment=PositionGetString(POSITION_COMMENT);               // position comment
      long   position_ID=PositionGetInteger(POSITION_IDENTIFIER);       // Identifier of the position
      if(magic==EXPERT_MAGIC || comment==IntegerToString(EXPERT_MAGIC))
        {
         HistorySelect(POSITION_TIME,TimeCurrent());
         for(int j=0; j<HistoryDealsTotal(); j++)
           {
            ulong deal_ticket=HistoryDealGetTicket(j);
            if(HistoryDealGetInteger(deal_ticket,DEAL_POSITION_ID) == position_ID)
              {
               deal_commission=HistoryDealGetDouble(deal_ticket, DEAL_COMMISSION)*2;
               break;
              }
           }
         Total_Profit+=PositionGetDouble(POSITION_PROFIT)+PositionGetDouble(POSITION_SWAP)+deal_commission;
        }
     }
   return(Total_Profit);
  }

Then you can print Comments or draw Labels/Text that incorporate the returned value onto your chart. This the easy part (Label):

Documentation on MQL5: OBJ_LABEL / Constants, Enumerations and Structures
Documentation on MQL5: OBJ_LABEL / Constants, Enumerations and Structures
  • www.mql5.com
Label object. Note Anchor point position relative to the label can be selected from ENUM_ANCHOR_POINT enumeration. Anchor point coordinates are set...