How to code? - page 122

 

I fixed it!

if (X01 > X02) {color_X01 = Lime;} else if (X01 < X02) {color_X01 = Red;} else {color_X01 = Yellow;}

if (X02 > X03) {color_X02 = Lime;} else if (X02 < X03) {color_X02 = Red;} else {color_X02 = Yellow;}

if (X03 > X04) {color_X03 = Lime;} else if (X03 < X04) {color_X03 = Red;} else {color_X03 = Yellow;}

if (X04 > X05) {color_X04 = Lime;} else if (X04 < X05) {color_X04 = Red;} else {color_X04 = Yellow;}

if (X05 > X06) {color_X05 = Lime;} else if (X05 < X06) {color_X05 = Red;} else {color_X05 = Yellow;}

if (X06 > X07) {color_X06 = Lime;} else if (X06 < X07) {color_X06 = Red;} else {color_X06 = Yellow;}

if (X07 > X08) {color_X07 = Lime;} else if (X07 < X08) {color_X07 = Red;} else {color_X07 = Yellow;}

if (X08 > X09) {color_X08 = Lime;} else if (X08 < X09) {color_X08 = Red;} else {color_X08 = Yellow;}

if (X09 > X10) {color_X09 = Lime;} else if (X09 < X10) {color_X09 = Red;} else {color_X09 = Yellow;}

 
hiachiever:
Matrixebiz,

if you want to start at 6 and go back to 0 then use i--

(int i=6; i>0; i--)

This will start at 6, decrement by 1 on each loop for as long as I > 0.

If you want to include 0 then use i>=0.

Cheers,

Hiachiever

Thank you for your help, one more question, is i++ the actual command that I have to use or can I change the letter like m++ to do the loop?

EG: (int m=2; m<=6; m++)

and if I never need it to go lower than 2 I can just put m=2 then continue the loop upto 6 max m<=6, correct?

and once the loop gets more than m<=6 like 7 then it stops and starts over, correct?

Thanks

 
:: everything is correct, except it will stop at 6 (not 7)
matrixebiz:
Thank you for your help, one more question, is i++ the actual command that I have to use or can I change the letter like m++ to do the loop?

EG: (int m=2; m<=6; m++)

and if I never need it to go lower than 2 I can just put m=2 then continue the loop upto 6 max m<=6, correct?

and once the loop gets more than m<=6 like 7 then it stops and starts over, correct?

Thanks
 

stop and waiting reverse

Hi coders!

Have one question:

Have got to code: buy close (TP or SL) after waiting sell setup.

Process of: buy, close, waiting sell entry, sell, sell close, waiting buy entry, buy.

Thank you the assistance!

Bobojsza

Sorry the bad english!

 
IN10TION:
:: everything is correct, except it will stop at 6 (not 7)

Thanks but is i++ the actual command that I have to use or can I change the letter like m++ to do the loop?

 
:: " i " is just a variable name so you can use whatever name. Like your " m ", use this variable name in the rest of your function.
matrixebiz:
Thanks but is i++ the actual command that I have to use or can I change the letter like m++ to do the loop?
 

Action on new bar

How can you tell (in your expert advisor) when there is a new bar opened in the current timeframe?

I have some code that needs to be executed each time a new bar pops up.

TIA

 
ssvl:
How can you tell (in your expert advisor) when there is a new bar opened in the current timeframe?

I have some code that needs to be executed each time a new bar pops up.

TIA

if (iBars>Bars) {

execute code;

Bars=iBars;

}

 

thx for the information, will try it out

i'm just started learning mql

 
ssvl:
thx for the information, will try it out i'm just started learning mql

Don't try it, do it