plot mid and opening ranges

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #196857 quote
    Jeroen1234
    Participant
    Senior

    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

    druby thanked this post
    #196891 quote
    JC_Bywan
    Moderator
    Master

    Hello,

    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=undefined

    druby and Jeroen1234 thanked this post
    #196902 quote
    druby
    Participant
    New

    Making 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.

    Jeroen1234 thanked this post
    #196967 quote
    Jeroen1234
    Participant
    Senior

    Hello @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

    Razz thanked this post
    #196970 quote
    JC_Bywan
    Moderator
    Master

    My bad, you’re obviously right with 47000, I completely forgot about no time math available on this one, so need to make up for it with 70 instead of 30mn.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

plot mid and opening ranges


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Jeroen1234 @jeroen1234 Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by JC_Bywan
3 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/06/2022
Status: Active
Attachments: 5 files
Logo Logo
Loading...