Help, on Trade Counter - page 2

 
Adebayo Samson Adewuyi:

but its not working,

no Problem thanks for the reply, i will continue trying 

Post the code and maybe I will see why it is not working.

 
Keith Watford:

Post the code and maybe I will see why it is not working.

int Limit=0; ////// on the global space



///// then i have the function below  my Tick function
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

int CountSell()

  {
    Limit=0;
   for(int i=0; i<=OrdersTotal(); i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         if(OrderMagicNumber()==Magic_Number_1 &&  OrderSymbol()==Symbol() && OrderType()==OP_SELL)
            Limit +=1;
     }

   return Limit;
  }
//+------------------------------------------------------------------+

this also reduce back when some orders are closed

 
Adebayo Samson Adewuyi:

this also reduce back when some orders are closed

You have totally ignored what I have said!

Keith Watford:

I think that you are going about it the wrong way.

You should have a globalscope or static variable to count the trades and set it to 0 initially (or the value of  OrdersTotal()).

Whenever a new trade is opened increase the counter by 1.

If   OrdersTotal()==0 reset it to 0.

How does your code even remotely resemble the above?

 
Keith Watford:

You have totally ignored what I have said!

How does your code even remotely resemble the above?

i told you earlier on that i don't fully understand what you explained

 
Adebayo Samson Adewuyi:

i told you earlier on that i don't fully understand what you explained

Then I can't help you.

 
Keith Watford:

Then I can't help you.

No problem, thanks for your time.

 

Keith Watford:

You should have a globalscope or static variable to count the trades and set it to 0 initially (or the value of  OrdersTotal()).

Whenever a new trade is opened increase the counter by 1.

If   OrdersTotal()==0 reset it to 0.

He told you exactly what to do need to do, for your stated want.

Adebayo Samson Adewuyi: if  i have 10 opened orders counter should read 10 and if 5 were closed counter should remain at 10 and if 2 more trades were opened counter should be at 12 (despite total orders are 7) and reset back to 0 (zero) when i have no opened orders

MT4: Learn to code it.
MT5: Begin learning to code it.
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

or pay (Freelance) someone to code it. Top of every page is the link Code Base.
          Hiring to write script - General - MQL5 programming forum 2019.08.21

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help 2017.04.21

 
William Roeder:

He told you exactly what to do need to do, for your stated want.

MT4: Learn to code it.
MT5: Begin learning to code it.
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

or pay (Freelance) someone to code it. Top of every page is the link Code Base.
          Hiring to write script - General - MQL5 programming forum 2019.08.21

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help 2017.04.21

to my level of understanding i did that, i declared Limit=0 as a global variable then i did a function "CountSell" to count all opened Sell Orders only.

 
Am Still on the Code anyone else viewing this topic that can point me to another solution should please help
Thanks
 
No solution yet  programmers your assistance is needed plz am so stuck on this
Reason: