Code of series of periods
Forums › ProRealTime English forum › ProBuilder support › Code of series of periods
- This topic has 24 replies, 5 voices, and was last updated 5 years ago by Vonasi.
-
-
07/06/2018 at 1:04 PM #75475
Good morning,
is there anybody who knows if there’s an easier way to write this code, in which the actual close is > or < of a series of previous close like this?
1close>close[1] and close>close[2] and close>close[3] and close>close[4] and close>close[5]....I need to put in a backtest with a variable X, that is the last of the series,
1if X is 5 then .....close>close[1] and close>close[2]....till close>close[5]Thanks so much
Maxx
07/06/2018 at 1:36 PM #7547707/06/2018 at 1:56 PM #75480What about
1IF close > highest[5](close[1]) THEN...?
07/06/2018 at 2:39 PM #7548207/06/2018 at 2:42 PM #7548407/06/2018 at 5:46 PM #75491As for the Vonasi’s code, ‘count’ variable should be reset to 0 before the FOR/NEXT loop, otherwise it will endlessly increase.
So not only harder but it doesn’t work! Why do in one line what you can do in 8. I blame it on the heat…..
07/06/2018 at 6:52 PM #7549807/06/2018 at 7:02 PM #75500OP wanted close of bar 1 > close of bar 2 and close of bar 2 > Close of bar 3 etc … put another way 5 bars with a increasing value of Close?
That is not what he wrote – he wrote this:
1close>close[1] and close>close[2] and close>close[3] and close>close[4] and close>close[5]....07/06/2018 at 7:03 PM #75501He always compared CLOSE, not CLOSE[previous bar].
Anyway, that would be
1IF summation[5](close > close[1]) = 5 THEN....07/06/2018 at 7:11 PM #75502That is not what he wrote – he wrote this:
Hahaha the heat is getting to all of us, I got it locked in my mind from initial reading (I should have reread) that he wanted an increasing value of close.
Cheers
07/06/2018 at 7:13 PM #7550307/06/2018 at 8:56 PM #7550707/07/2018 at 7:34 AM #75516CLOSE[previous bar]. Anyway, that would be
Code added to Snippet Link Library
08/04/2019 at 1:52 PM #104152Sorry for reviving this old topic, but after thinking it over and with a whole additional year experience… VONASI was right (apart from resetting count to 0 at line 2 as suggested by Nicolas).
My code always compares the current candle to the previous one, which is not exactly what maximus78 wanted. Indeed I believed using CLOSE without brackets would do, but summation reads it as being CLOSE[0], then it shifts both every iteration, so that the next one would be CLOSE[1] compared to CLOSE[2] and so on. CLOSE does NOT remain CLOSE[0] thus making a loop necessary.
08/04/2019 at 2:29 PM #104154VONASI was right
Finally almost thirteen months later I get the recognition that I deserve. I’ve had trouble sleeping at night ever since I posted something that was thought to be wrong. Thank goodness that nightmare is now over. 🙂
Strangely maximus78 was happy with your code Roberto so perhaps what he wanted and what he described were actually different things? It wouldn’t be the first time someone did that on the forums!
-
AuthorPosts
Find exclusive trading pro-tools on