Problems with arrays value...

 

Hello all,

I have got a problem to put an "initial" array value in one shot...At start Price [2]= 0. The Alert return me Price[2]= 0 (Again!), but Price [1]=RedYL, why Price [2] no value?? With Step [6]=10....

if (Step [6]>= 10)
{
for(LockY= Price [2]; LockY== 0; LockY= Price [2])
{
Price [1]= RedYL;
Price [2]= Bid;
}
}

Alert ("Price1= ", Price [1], "Price2= ", Price [2]);

The Price [] arrays that i use is 4...I have wrong with declaration?

Thank You

 

Hi K

Don't understand what you are trying too do. The "for" statement looks gobbledeegook to me.

You set LockY to the value of Price[2] and that will be zero at the start and you don't increment anything but set LockY to zero via Price[2] again. @@@@

Price[1] & Price[2] never get reached. Maybe if I have a beer it will become clear?

 
Ruptor wrote >>

Hi K

Don't understand what you are trying too do. The "for" statement looks gobbledeegook to me.

You set LockY to the value of Price[2] and that will be zero at the start and you don't increment anything but set LockY to zero via Price[2] again. @@@@

Price[1] & Price[2] never get reached. Maybe if I have a beer it will become clear?

Hi Ruptor,

Maybe...Gobbledeegook? Wow, is new for me this words! Sorry, but i have a little problem to explain, like a drunk :) And a little pratice of language program...I try to put a value into a array ONLY ONE TIME (because bid is variable) when Step [6]>10. The value are Price [1]= Bid and Price [2]= RedYL...But "FOR" never do it, i can try to tell you, as i think about it...At start LockY= Price [2]; (Price [2] has no value), then, IF LockY== 0 (true, price [2] has no value...), execute the "cycle body" Price [1]=RedYL; Price [2]= Bid;, at finish set LockY=Price [2]= Bid?? (Note: after FOR only Price [2]= RedYL is correct!!!!) ...Tick after, LockY= Price [2] = Bid != 0, never start FOR again, beacuse condition is false??....

Well, i hope to be more clear! :)

Thank you so much!

 

Hi K

Just use a boolean switch it's much easier to understand.


if(PriceSet==false){

PriceSet=true;

Price [1]= RedYL;
Price [2]= Bid;

}


You can && any condition to qualify the entry point for setting the prices.

Reason: