stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

HELP with && and || operators
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3172
Page 1 of 1
Author:  fx800 [ Fri Sep 27, 2013 10:38 am ]
Post subject:  HELP with && and || operators

deleted
Author:  milanese [ Fri Sep 27, 2013 10:41 am ]
Post subject:  Re: HELP with && and || operators

fx8000 wrote:I am often unsure which is the coorect operator to use.

Say, I would like to code


if either of (prevstochval <= 20 && stochval > 20) OR (prevstochval <= 40 && stochval > 40) , send long is true.


Which one is correct

1.
if ( (prestochval <= 20 && stochval > 20) || (prestochval <= 40 && stochval > 40) ) SendLong = true;

2.
if ( (prevstochval <= 20 && stochval > 20) && (prevstochval <= 40 && stochval > 40) ) SendLong = true;

Many thanks.

peter
Hi Peter,

the first one

Cheers :)
Tommaso
All times are UTC Page 1 of 1