Operator &&
Author: mrsic
Creation Date: 11/19/2016 2:36 PM
profile picture

mrsic

#1
Hi,

I'm not a prgroammer, but can someone explain to me if that is correct?

CODE:
Please log in to see this code.


Means:
If Bars.Open is smaller than Bars.High(yesterday) and Bars.Open(Price) <= x Percentage
BuyAtMarket(Next day on Open)

If not than is Bars.Open also false.

Is that correct.

thanks.

greetings
Damir
profile picture

Eugene

#2
Hi,

QUOTE:
If Bars.Open is smaller than Bars.High(yesterday) and Bars.Open(Price) <= x Percentage

The idea is correct (except that the "High" in your description should read "Low" or vice versa - compared to your code snippet).

QUOTE:
If not than is Bars.Open also false.

I didn't understand this part.

P.S. When using multiple operators be careful to honor operator precedence, though. To stay on the safe side, use parenthesis to make it explicit.
profile picture

mrsic

#3
Hi Eugene,

QUOTE:
The idea is correct (except that the "High" in your description should read "Low" or vice versa - compared to your code snippet).


Correct. Thanks.

QUOTE:
I didn't understand this part.


if Bars.Open isn't smaller than Bars.Low, than will the second part (&& Bars.Open) be false or not done ( No Entry). Is that correct?

greetings
profile picture

Eugene

#4
Correct. Both parts have to be true or no entry will take place.

P.S. The difference between & and && is that with && if the left condition is false, the right part is not evaluated.
profile picture

mrsic

#5
Thanks.