A coding question
Forums › ProRealTime English forum › ProOrder support › A coding question
- This topic has 5 replies, 4 voices, and was last updated 1 year ago by WingYip.
-
-
07/10/2022 at 10:44 AM #197072
Hi, it would be nice if someone can answer this….
Are this 2 code are the same and work the same way?
CLOSE < low[1] or CLOSE < low[2] or CLOSE < low[3] or CLOSE < low[4]
——————————————–
CLOSE < (low[1] or low[2] or low[3] or low[4])
Many thanks
07/10/2022 at 11:16 AM #197073Hi, it would be nice if someone can answer this….
Are this 3 code are the same and work the same way?
CLOSE < low[1] or CLOSE < low[2] or CLOSE < low[3] or CLOSE < low[4]
——————————————–
CLOSE < (low[1] or low[2] or low[3] or low[4])
————————————————-
c1 = CLOSE < low[1]
c2 = CLOSE < low[2]
c3 = CLOSE < low[3]
c4 = CLOSE < low[4]
s1 = c1 or C2 or C3 or c4
Many thanks
07/10/2022 at 12:31 PM #197074If you number your options then it’s easier fior us to help you as we can easily refer to numbers. 🙂
This
S1 = CLOSE < low[1] or CLOSE < low[2] or CLOSE < low[3] or CLOSE < low[4]
is same as
c1 = CLOSE < low[1]
c2 = CLOSE < low[2]
c3 = CLOSE < low[3]
c4 = CLOSE < low[4]
s1 = c1 or C2 or C3 or c4
This one
CLOSE < (low[1] or low[2] or low[3] or low[4])
won’t work for what you want it to do, e.g. or low[2] will only give you the value of low 2 bars ago.
1 user thanked author for this post.
07/10/2022 at 12:39 PM #197075Code1,2,and 31234567891011Code1 = Close<Low[1] or Close<Low[2] or Close<Low[3] or Close<Low[4]Code2 = Close<Low[1] or Low[2] or Low[3] or Low[4]c1 = Close<Low[1]c2 = Close<Low[2]c3 = Close<Low[3]c4 = Close<Low[4]Code3 = c1 or c2 or c3 or c4Return Code1 as "Code1", Code2 as "Code2", Code3 as "Code3"In addition to GraHal’s explanation:
You can set up a simple indicator to test…
Then you see that Code1 and Code3 give the same results (0 or 1) but that Code2 is always true (always 1). This is probably because in Code2 you don’t give a condition to Low[2], Low[3] and Low[4]. So you’re basically saying here, is there a Low[2] or a Low[3] or a Low[4] (and there always are).
2 users thanked author for this post.
07/10/2022 at 2:26 PM #197077As to your first post:
- the first line is correct, it’ll be true whenever CLOSE < anyone of the previous 4 LOWs
- the second line is logically incorrect, as it will ALWAYS be true, as you do not compare CLOSE to those LOWS; you compare CLOSE to the fact that anyone of those LOWs is <> 0, which cannot be false.
07/10/2022 at 3:31 PM #197082 -
AuthorPosts
Find exclusive trading pro-tools on