**SDC**:

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

2327

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

2397

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 ?

2327

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]++

2397

Awesome !! thanks for your help Gordon I've been puzzling over that one for the past 2 hours I'll implement it like you said with the -1 I wouldnt have thought of that, now Ill be able to finish my order accounting function tonight.

You are missing trading opportunities:

- Free trading apps
- Free Forex VPS for 24 hours
- Over 8,000 signals for copying
- Economic news for exploring financial markets

Registration
Log in

You agree to website policy and terms of use

If you do not have an account, please register

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 ?