Friday Close and Monday Open Gap

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #211198 quote
    s00071609
    Participant
    Senior

    Hi Guys

    How to draw a horizontal shade between price close on Friday at 8 am and Open on Monday 10 am. This is Au time that my charts are in.

     

    Any help would be great

    #211222 quote
    ZeroCafeine
    Participant
    Senior

    maybe you can draw a Rectangle ?

    #211227 quote
    robertogozzi
    Moderator
    Master

    There you go:

    DEFPARAM DrawOnLastBarOnly = true
    IF OpenTime = 080000 AND OpenDayOfWeek = 5 THEN
       Bar8  = BarIndex
       cl    = close
       Bar10 = Bar8
       op    = cl
    ENDIF
    IF OpenTime = 100000 AND OpenDayOfWeek = 1 THEN
       Bar10 = BarIndex
       op    = open
    ENDIF
    DrawSegment(Bar8,cl,bar10,op)
    RETURN
    ZeroCafeine thanked this post
    #211241 quote
    s00071609
    Participant
    Senior

    I added it to the chart but it did not draw anything?

    #211242 quote
    JC_Bywan
    Moderator
    Master

    Hi,

    Not knowing what TF you used and how much history you loaded, these are hypothetical items to check, just in case:

    – is it a timeframe compatible, meaning having candles open/close timing compatible with these coded times? (so… not x ticks, not daily, etc…)

    – and if yes, are there enough units loaded to have the first point last friday at 8 part of available history? (for example, if 1mn TF, having 10000 rather than only 1000 units)

     

    (PS: from moderation point of view, moving the topic from French forum to English forum in a few minutes, thanks)

    #211247 quote
    s00071609
    Participant
    Senior

    Thanks for the code. I am using it in 5m chart with 10K bars loaded, so its definately not working. I am sure something minor is missing

    #211248 quote
    JC_Bywan
    Moderator
    Master

    Another possibility comes to mind: when you say “added to the chart”, do you mean inside the price window, or does it appear as a separate window at the bottom of the chart?

    #211250 quote
    s00071609
    Participant
    Senior

    Yes off course price window

    #211255 quote
    s00071609
    Participant
    Senior

    Ok i could not see it due to colour its drawing a line. How can I have it draw a rectange that extends to current price just like line?

    #211257 quote
    JS
    Participant
    Senior
    DEFPARAM DrawOnLastBarOnly = true
    IF OpenTime = 080000 AND OpenDayOfWeek = 5 THEN
    Bar8  = BarIndex
    cl    = close
    ENDIF
    IF OpenTime = 100000 AND OpenDayOfWeek = 1 THEN
    Bar10 = BarIndex
    op    = open
    ENDIF
    Drawrectangle(Bar8,cl,bar10,op)
    RETURN
    
    ZeroCafeine thanked this post
    #211267 quote
    s00071609
    Participant
    Senior

    Horizontal Rectangle, like pivot lines. ITs because, if you load this indicator in 5m or 1 m chart, you cannot see it without scrolling all the way to Monday. thanks

    #211281 quote
    s00071609
    Participant
    Senior

    Hi Roberto

    Is it possible to have hortizontal rectange accross rather than a segment?

     

    thanks

    PJ

    #211299 quote
    robertogozzi
    Moderator
    Master

    This is a modified version of https://www.prorealcode.com/topic/friday-close-and-monday-open-gap/#post-211257:

    DEFPARAM DrawOnLastBarOnly = true
    IF OpenTime = 080000 AND OpenDayOfWeek = 5 THEN
       Bar8p = Bar8
       Bar8  = BarIndex
       cl    = close
    ENDIF
    IF OpenTime = 100000 AND OpenDayOfWeek = 1 THEN
       Bar10 = BarIndex
       op    = open
    ENDIF
    Drawrectangle(Bar8p,cl,bar10,op) coloured("Red",20) bordercolor("Cyan") style(line,2)
    RETURN

    20 is the transparency attribute (0=invisible, 255=max.visibility).

    2 is the line thickness (1 to 5).

    ZeroCafeine thanked this post
    #211306 quote
    s00071609
    Participant
    Senior

    Thanks but it looks bit odd in the chart. It seems to be connecting all open and close of new week. I was expecting it to have individual shades for DClose of Saturday (AEST) and DOpen (Monday). Is it not possible to have a line that extend to current price area?

    #211317 quote
    robertogozzi
    Moderator
    Master

    This version gets rid of some mess (when uncommenting line 1):

    //DEFPARAM DrawOnLastBarOnly = true
    IF OpenTime = 080000 AND OpenDayOfWeek = 5 THEN
       Bar8  = BarIndex
       cl    = close
    ENDIF
    IF OpenTime = 100000 AND OpenDayOfWeek = 1 THEN
       Bar10 = BarIndex
       op    = open
    ENDIF
    IF Bar10 > Bar8 THEN
       Drawrectangle(Bar8,cl,bar10,op) coloured("Red",20) bordercolor("Cyan") style(line,2)
    ENDIF
    RETURN

    Of course you will have to change those times, as they are CET (EU) times.

    DCLOSE, DOPEN, etc… match the broker’s day start (which is now at 01:00, not 00:00). This means that 00:00 are still visible, but with OpenDayOfWeek they belong to the previous day, despite the date being correct.

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

Friday Close and Monday Open Gap


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
s00071609 @s00071609 Participant
Summary

This topic contains 14 replies,
has 5 voices, and was last updated by robertogozzi
2 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/09/2023
Status: Active
Attachments: 2 files
Logo Logo
Loading...