HELP with && and || operators

Post Reply
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

HELP with && and || operators

Post by fx800 »

deleted
Last edited by Anonymous on Sun Oct 06, 2013 9:21 am, edited 2 times in total.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Re: HELP with && and || operators

Post by milanese »

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
Post Reply

Return to “Coders Hangout”