plot mid and opening ranges
Forums › ProRealTime English forum › ProBuilder support › plot mid and opening ranges
- This topic has 4 replies, 3 voices, and was last updated 2 years ago by JC_Bywan.
-
-
07/06/2022 at 9:08 AM #196857
hello PRT users, can you help me figuring out a little error in my code, I seem not to figure it out, might be a simple solution but I do not have it yet;
I made a code (thanks to ProRealCode.com for some input) tp plot (on 1 sec chart) the MID (simply average between high and low, but after opening of markets) opening range (first swing high and low) and 1st hour high and low. my code will plot this after the European (German) open and again after US opening. this levels are quite important support and resistance, often stops are on the other side of it as well.
my problem is that the code plot the lines from 1 or 2 days ago on very ‘strange levels, and therefore the graph zooms out so much that it’s quite some work to get it zoomed in again. I seem not to find the solution to avoid this, perhaps I need to code to only start today, but I tried may methods but still not successful. So I need to avoid the plot of the lines as see in screenshot NQ 1 – 1 sec, in screenshot NQ 2 – 1 sec you see how it looks like today. (and should also look like yesterday for yesterdays session.
the code (Mid and ranges – 1 sec.itf) is attached.
(by the way, in screenshot 2 you can see how MID is holding first as the resistance, after that it breaks nicely wit the reached target of opening range (swing) low)
thanks Jeroen
1 user thanked author for this post.
07/06/2022 at 2:25 PM #196891Hello,
Line 22 are you sure you want the +30? Not just because you might want to initialise values without the +30, but also because in line 41 you ask to plot from openingstart, not openingstart+30.
Also you may want to use opentime instead of time when measuring against openingstart in lines 22,31,41,53,65 and probably line 7 too.
I guess a2=47000 is a typo and you wanted 43000 instead
And, I say this last because it would change line numbers vs your attached file, but these are the lines to add that will solve your zoom issues and they need to go at line 3 just after both defparams lines:
once ORHigh=undefined
once ORLow=undefined
once CashMID=undefined
once Cash1stHourHigh=undefined
once Cash1stHourLow=undefined2 users thanked author for this post.
07/06/2022 at 4:37 PM #196902Making a variable equal to ‘undefined’ after the ‘Once’ instruction is a stroke of genius.
This effectively hide the variable, from a drawing point of view, till its re-initialization later and then starts drawing it, overriding the initial automatic initialization of zero. This then avoiding a possible acute change in value from zero and having a extreme y scale range.
I knew what this did but couldn’t work out why use it, but now I know, and, perhaps I would have known early if I’d looked at the later examples it mentioned in the programming guide. Dam!
Thanks JC, and jeroan, can’t help, your problem is way beyond me at this time. All the best.
1 user thanked author for this post.
07/07/2022 at 11:52 AM #196967Hello @JC_Bywan, thanks for your answer,
you mention line 22 if i really want the +30, your right, I am not sure, actually I struggle to get the opening swing properly plotted; opening swing high, first high after open and opening swing low; first low after open, I probably thought let it start a bit later for this swing, but it does not really work. line 41 is only for the IB high/low (first hour high and low), so therefore I did not do the +30. but I removed it for now from line 22.
line 8, a2 is 47000 because end of cash ETH session in US is 22 hr (for AMS or UTC+2), so 173000+47000= 220000.
Thanks for the solution of the zoom issue, this is exactly what I needed, appreciated!
now for the first swing high and low, probably manual is easier…
Jeroen
1 user thanked author for this post.
07/07/2022 at 11:59 AM #196970 -
AuthorPosts
Find exclusive trading pro-tools on