Need help with arrays to count highs and lows with conditions
Forums › ProRealTime English forum › ProBuilder support › Need help with arrays to count highs and lows with conditions
- This topic has 7 replies, 4 voices, and was last updated 3 years ago by Nobody.
Tagged: array
-
-
12/15/2020 at 12:27 AM #153777
Im not sure if its correct to make a request for help here or to use niclas’ thread so please move my post if you feel like it mods.
Im fairly new with PRT v11 arrays and im trying to wrap my head around it. Would love to get some help.
I wanna start with something fairly simple. Please look at attached screenshot for details.So for starters i want to do 2 things:
- Count as explained in the photo. Count the amount of highs and count the amount of lows, seperatly.
- I want to be able to use the price of the different levels. Lets for example say that my system demands a count higher than 3, and i want to buy if low closes under point 2.
And im not begging for the code here, a walkthrough on how to do it would be amazing, so i dont have to bother you guys forever 🙂 Teach a man to fish etc!
Edit: btw the photo is daily candles on amazon in end of July month 2020
Edit2: If im wrong about the numbers in the index its because i dont quite understand it yet! Or i might have botched a copy paste 🙂 in other words, i might be wrong
12/15/2020 at 8:52 AM #15379512/19/2020 at 11:32 PM #154496i assume i would need to start with
1if high crosses over highest[period1](high[1]) thenThis would be the trigger to start the count. As long as there is no higher high then that point then the count continues. I would also need to stop the count if it breaks to the downside. I think that point would have to be low crosses under lowest[period2] from the highest high point.
After that i would code in the lower low/higher highs
123If low crosses under lowest[period](low[1]) and low > lowest-low-period-before-highest-high-that-started-count thenif high crosses over highest[period](high[1]) and high < highest-high-that-started-count then12/19/2020 at 11:38 PM #15449812/22/2020 at 1:57 AM #154808Maybe this will help with showing what level of understanding im at..
1234567891011121314151617181920212223242526272829303132333435363738a1 = 0b1 = 0c1 = 0d1 = 0abcd = 0$var[0] = highest[50](high[1]) // highest high past 150 bars$var[1] = highest[30](high)[15] //highest high past 50 bars from 30 bars ago$var[2] = highest[15-1](high)[1] //highest high past 30 bars$varlow[0] = lowest[80](low) // highest high past 150 bars$varlow[1] = lowest[30](low)[15] //highest high past 50 bars from 30 bars ago$varlow[2] = lowest[15-1](low)[1] //highest high past 30 barsa = $var[0] > $var[2]b = $var[1] > $var[2]c = $varlow[0] < $varlow[1] and $varlow[0] < $varlow[2]d = $varlow[1] > $varlow[2]if a thena1 = 1endifif b thenb1 = 1endifif c thenc1 = 1endifif d thend1 = 1endifif a and b and c and d thenabcd = 2endifreturn a1 as "a" ,b1 as "b" ,c1 as "c" ,d1 as "d", abcd as "abcd down!"12/22/2020 at 10:36 AM #154867You don’t really need to use arrays if you just want to record the last highest high and last lowest low and perhaps the ones before that. Think of arrays as a big filing cabinet that you can store lots of information in to later search through easily. If you only have a couple of bits of paper to store then you don’t need to use a filing cabinet – a couple of envelopes will do.
12/22/2020 at 11:04 AM #15487301/13/2021 at 3:39 PM #157665Some of the best most useful threads in PRC are the ones with tumbleweeds imo . Post an uber optomised no logic curve and the crowd flocks in . Never ceases to amaze me .
Profit is onto something with his ” count ” imo . Add some volatility filter and couple more simple parameters and you got a ” thing ”
rock on and yeah its cryptic
-
AuthorPosts
Find exclusive trading pro-tools on