Counting closed orders

 

Hi all,

I need to get the number of orders that have been closed.

Could you show me how could one get that from order history ?

thank you in advance for any support provided

Luis

 
luisneves:

Hi all,

I need to get the number of orders that have been closed.

Could you show me how could one get that from order history ?

thank you in advance for any support provided

Luis


if you know how to count open trades .......

then it will be a little step to do an attempt for writing this code counting closed trades

How often do you wanna be answered like ....

Search for it (do your own research,) learn to code it, or pay someone.

We're not going to code it FOR you.

We are willing to HELP you when you post your attempt

 
deVries:


if you know how to count open trades .......

then it will be a little step to do an attempt for writing this code counting closed trades

How often do you wanna be answered like ....

Search for it (do your own research,) learn to code it, or pay someone.

We're not going to code it FOR you.

We are willing to HELP you when you post your attempt


Hi deVries;

Thank you for your prompt response to my issue.

here is my attempt to get the number of closed orders;

  void LotIncrease()
//---- 
       {//0                     
        for(int Orders = OrdersTotal()-1; Orders >= 0; Orders--)       
          {//1
          if(!OrderSelect(Orders,SELECT_BY_POS,MODE_HISTORY))continue;
            {//2
            if(OrderSymbol() == Symbol()&& OrderMagicNumber() == MagicNumber)            
              {//3
              Total = OrdersHistoryTotal();                                                                                 
              }//3          
            }//2
          }//1                                                                 
//----                                
       }//0

So let's go in more detail of what I'm trying to get;

In a sell if profit hasn't been reached then that order is closed and the next order should open but with an increased volume, the same for a buy.

If the profit is hit then the order is closed and the Total should be reset to zero.

Right now some times the orders are opening with the right volume, but others open with a different volume.

I want to use Total as;

OrderSend(Symbol(), OP_SELL,MathPow(2,Total)*Lots, Bid, Slippage*pips2points, 0,0, "Sell Opposite Order", MagicNumber, 0, Red);

Best regards

Luis

 
luisneves: So let's go in more detail of what I'm trying to get;

You need to RTFM

  1. for(int Orders = OrdersTotal()-1; Orders >= 0; Orders--) 
    
    Looping over all OPEN and PENDING orders. Has what to do with your question?
  2. if(!OrderSelect(Orders,SELECT_BY_POS,MODE_HISTORY))continue;
    Selecting history orders based on the count of OPEN and PENDING orders. Means what?
  3. if(OrderSymbol() == Symbol()&& OrderMagicNumber() == MagicNumber)  
    
    Filtering history by symbol/MN. The only thing you posted that makes sense.
  4. Total = OrdersHistoryTotal(); 
    
    You knew about the history count, so why did you do #1? What does the Total Closed/Deleted count have to do with your question?
  5. Why didn't you post the code first instead of asking "Could you show me how could one get that from" which results in the response: "Since there are no slaves here, you have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem."

learn to code

it yourself. We are tired of your asking for every single, simple thing.
 
WHRoeder:

You need to RTFM

  1. Looping over all OPEN and PENDING orders. Has what to do with your question?
  2. Selecting history orders based on the count of OPEN and PENDING orders. Means what?
  3. Filtering history by symbol/MN. The only thing you posted that makes sense.
  4. You knew about the history count, so why did you do #1? What does the Total Closed/Deleted count have to do with your question?
  5. Why didn't you post the code first instead of asking "Could you show me how could one get that from" which results in the response: "Since there are no slaves here, you have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem."

learn to code

it yourself. We are tired of your asking for every single, simple thing.


Hi WHRoeder,

Before all,thank you for your response to my issue.

Regarding your last comment I apology for any inconvenience in keeping asking for guidance in the Forum and keeping taking your and others precious time.

This was my last time that I keeping taking the time of all of you with my issues.

All the best for you all.

Luis

Reason: