Help For Array elements

 

I need some suggestion about using the array...

i already read some topic that related with array, but still confused...

here is what i am up to :

~ i want to use two dimension array with element fills with price that given. i.e : First Dimension for BuyStop Price and Second Dimension for Sellstop.

price[][0] : / price to buy

[][1] : / price to sell

first element for both dimension is 1.6415 (buystop; B) and 1.6400 (sellstop; S)

i want to make n element with formula : DiffToPoint = 15

midprice = (1.6415 + 1.5400)/2

price[0][0] = 1.6415 ; price[0][1] = 1.6415

price[1][0] = midprice + DiffToPoint*Point ; price[1][1] = midprice - DiffToPoint*Point

price[2][0] = midprice + (2*DiffToPoint)*Point ; price[2][1] = midprice - (2*DiffToPoint)*Point

price[3][0] = midprice + (3*DiffToPoint)*Point ; price[3][1] = midprice - (3*DiffToPoint)*Point

...............

...............

price[n][0] = midprice + (n*DiffToPoint)*Point ; price[n][1] = midprice - (n*DiffToPoint)*Point

~ after that how to call the price that given in the 10th element for both dimension (for example).

Pb = price[1][0]

Ps = price[1][1]

OrderSend(Symbol( ), OP_BUYSTOP, Lot, Pb, Slippage, 0, 0, 0, bmagic, 0, clOpenBuy);

OrderSend(Symbol( ), OP_SELLSTOP, Lot, Ps, Slippage, 0, 0, 0, smagic, 0, clOpenSell);


Can anyone help for this?

 

Hi,


I think you are doing it the wrong way. Should be like this:


//prices for sell

price[0][1] = ...

price[0][2] = ...

price[0][3] = ...

. . . . .

price[0][n] = ...



//prices for buy

price[1][1] = ...

price[1][2] = ...

price[1][3] = ...

. . . . .

price[1][n] = ...

Reason: