{MQL4) How to know OrdersTotal() is decreased.

To add comments, please log in or register
kajironpu
202
kajironpu  

Hi,I want to know how to code the OrdersTotal() is changed(decreased).


For example, I have 5 orders now. OrdersTotal()=5.

If one order is closed (either TP or SL)  and OrdersTotal() is now 4 orders, The number of order was  decreased.

How can I know this?

Fernando Carreiro
4802
Fernando Carreiro  

kajironpu: Hi,I want to know how to code the OrdersTotal() is changed(decreased).For example, I have 5 orders now. OrdersTotal()=5. If one order is closed (either TP or SL)  and OrdersTotal() is now 4 orders, The number of order was  decreased. How can I know this?

By using Static Variables:

void OnTick()
{
   static int intOrdersTotalCurrent = OrdersTotal(); 
   int intOrdersTotalPrevious = intOrdersTotalCurrent;
   intOrdersTotalCurrent = OrdersTotal();

   if( intOrdersTotalCurrent > intOrdersTotalPrevious )
   {
      // Orders increased
   }

   if( intOrdersTotalCurrent < intOrdersTotalPrevious )
   {
      // Orders decreased
   }

   return;
}
Static Variables - Variables - Language Basics - MQL4 Reference
Static Variables - Variables - Language Basics - MQL4 Reference
  • docs.mql4.com
A static variable can be initialized by a constant or constant expression corresponding to its type, unlike a simple local variable, which can be initialized by any expression. Static variables exist from the moment of program execution and are initialized only once after the program is loaded. If the initial values are not specified, variables...
kajironpu
202
kajironpu  

Hi, Fernando san

Thank you so much.

This is what I was looking for. Static Variables

I need to strudy  Static Variables.

Gracious.

Static Variables - Variables - Language Basics - MQL4 Reference
Static Variables - Variables - Language Basics - MQL4 Reference
  • docs.mql4.com
A static variable can be initialized by a constant or constant expression corresponding to its type, unlike a simple local variable, which can be initialized by any expression. Static variables exist from the moment of program execution and are initialized only once after the program is loaded. If the initial values are not specified, variables...
Fernando Carreiro
4802
Fernando Carreiro  
kajironpu:

Hi, Fernando san

Thank you so much.

This is what I was looking for. Static Variables

I need to strudy  Static Variables.

Gracious.

You are welcome!

PS! When you used the word "Gracious", were you trying to say "Thank you" in my language?

If so, "Gracias" is Spanish. In Portuguese it would be "Obrigado", which sounds similar to the equivalent Japanese word "Arigatō" ("ありがとう")!

kajironpu
202
kajironpu  

Obrigado!!

Fernando Carreiro
4802
Fernando Carreiro  
kajironpu: Obrigado!!

How would I say the equivalent of "You are welcome!" in Japanese?

This is what I got from Google translate:

どういたしまして!

Fernando Carreiro
4802
Fernando Carreiro  
M.R.:

No, it is not what you present! "People want and see the thing as they are in their head, and never as they are OUT".

Middle English: via Old French from Latin gratiosus, from gratia ‘esteem, favour’

(But now I would need to explain 'favour' or ''esteem'' meaning, which are totally different... no way)

But if You insist from where came that another "S" in the word Gracio(s)us from him/her, it is from the oldest language (before any others, and you don't know it), and it is joke "sus" add to any other word.

Sus means similar to "get away". And in his/her word would be understandable meaning of emotion 'thank you' from inside to go away the word 'thank you' because that word does not make pleasant feeling in him/her. Reality is better. Helps me helps you is better.

""Ancients are not monkeys, but humans with time are becoming adapted to Earth and becoming more to monkeys.""

It is not intended to You this sentence Fernando.

From time to time someone on the globe gets memory from the some of the oldest words and makes combinations of words without any intention, it is written in 'some' of the dna banks, and gets 'read' upon specific emotion. With time will be lost and people will adapt to be monkeys "again", as it happened in past. It is not thousands years, not millions, not billions, more but you can imagine.

English Wisdom (which I do not follow) : "Someone not knowing the truth, can not cover it with lies or un-knowledge".

What on earth are you on about?

I know very well what "gracious" means in English (I am a native English speaker even though I'm Portuguese), but as you can see from the OP's response, he misspelled the word while trying to say "thank you" to me in my own language. He was under the impression that in Portuguese and Spanish they would be the same.

Also, please spare me the linguistics lesson when you have to resort to Google translate to explain English to me.

M.R.
46
M.R.  
Fernando Carreiro:

What on earth are you on about?

I know very well what "gracious" means in English (I am a native English speaker even though I'm Portuguese), but as you can see from the OP's response, he misspelled the word while trying to say "thank you" to me in my own language. He was under the impression that in Portuguese and Spanish they would be the same.

Also, please spare me the linguistics lesson when you have to resort to Google translate to explain English to me.

I speak English and German since my 3-rd. Between other 2 languages, with time 5-th and more. I will not make any more lessons, sorry .
To add comments, please log in or register