array[MagicNumber][OrderType]++
then i realised although it would count how many orders of each type there are at the same time it would also increase the magic number index every time a new order is found
Really ? Thanks Gordon I thought I had it wrong, there wouldnt be any entry in the zero index because my lowest magic number will be 1 that could be any order type though
so if I use:
array[MagicNumber][OrderType]++
considering
OP_BUY | 0 | Buying position. |
OP_SELL | 1 | Selling position. |
OP_BUYLIMIT | 2 | Buy limit pending position. |
OP_SELLLIMIT | 3 | Sell limit pending position. |
OP_BUYSTOP | 4 | Buy stop pending position. |
OP_SELLSTOP | 5 | Sell stop pending position. |
If I had 3 open buy orders all with magic number 4
and 2 pending Sell Limit orders both with the magic number 6
array[4,0] would hold the value 3 and array[6,3] would hold the value 2 ?
If I had 3 open buy orders all with magic number 4
and 2 pending Sell Limit orders both with the magic number 6
array[4,0] would hold the value 3 and array[6,3] would hold the value 2 ?
Yes.
[...] there wouldnt be any entry in the zero index because my lowest magic number will be 1 [...]
You can do this:
array[MagicNumber-1][OrderType]++
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I wonder if someone might help me with this problem
I understand how to make a 1 dimensional counter array to count the amount of something like
array[6]
array[OrderType()]++
would count the amount of orders of each type there are while in a order_by_pos checking loop
is it possible to make a 2 dimensional array where only the second index counts the frequence of something ?
where there are several orders which may have different magic numbers between 1 and 9
and I want to list in the array how many orders of each type have the same magic number at first I thought i could do it something like this
array[10][6]
array[MagicNumber][OrderType]++
then i realised although it would count how many orders of each type there are at the same time it would also increase the magic number index every time a new order is found
how would i create a counter that would work on the second index independantly from the first ?