![]() |
or/and conditions in same scan |
Post Reply ![]() |
Author | |
cudderbean ![]() Regular ![]() ![]() Joined: 02 Oct 2006 Location: Thailand Posts: 40 |
![]() ![]() ![]() ![]() Posted: 10 Oct 2006 at 1:11am |
I think I've answered my own question by doing the obvious... RTBM - "Read The Blinking Manual!". Durrrrh! Under the section Logical Operators in the Bullscript Help Files: "Note in the table above that AND has a higher order of precedence than OR. The AND and OR operators behave like multiply and plus with respect to each other. For example, the expression: "tea OR coffee AND sugar" is actually interpreted to be "tea OR (coffee AND sugar)". Parentheses must be manually added to force the OR to have a higher precedence, such as in: "(tea OR coffee) AND sugar" This may seem counter intuitive at first, but it is standard in most computer languages." Here's the answer I was looking for. Note the brackets! {Variables} _var1 := ma(Close,14,Simple); {Condition} ((Close > _var1) Thumbs up to the BC development team: I'm thoroughly enjoying your product. |
|
![]() |
|
cudderbean ![]() Regular ![]() ![]() Joined: 02 Oct 2006 Location: Thailand Posts: 40 |
![]() ![]() ![]() ![]() |
I am loving Bullcharts For example, I want to grab both sets of contingencies in the “same” scan.. EITHER the close is greater than the simple 14 day MA of the close AND the MACD Histogram is greater than 0 OR, the close is greater than the simple 14 day MA of the close AND Directional Movement +DI crosses above the Directional Movement -DI {Variables} _var1 := ma(Close,14,Simple); _var2 := formula("MACD Histogram", 12, 26, 9); _var3 := formula("Directional Movement +DI", 14); _var4 := formula("Directional Movement -DI", 14); {Condition} {EITHER} filter := (Close > _var1) and (_var2 > 0) {OR} and (Close > _var1) and (cross(_var3, _var4)); filter; Thank you for your help. |
|
![]() |
Post Reply ![]() |
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |