Indicator to display Asian time zones

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #66240 quote
    SSM1
    Participant
    New

    Good morning guys,

    I have just joined this forum this morning and looks to be lots of great information and very knowledgable people on here.

    Was just wondering if someone might be able to point me in the right direction as I am sure this would already be available, but I can not seem to find anything.

    What I am after is an indictor which displays the Asian session on my charts  (i.e Just a box around the candles from the open to close, with high and low being the top and bottom of the box) I am looking to backtest something and this would really help me out and save having to manually draw them on multiple times on each chart.

    Any help that is available would really be appreciated,

    Regards,

    Simon

    #66423 quote
    robertogozzi
    Moderator
    Master

    There you go

    DEFPARAM DrawOnLastBarOnly   = True              //Only display lines on the last bar (not to overstuff the chart with useless lines)
    
    //                     initialize variables at launchtime
    ONCE StartTime               = 230000            //Start of Asian session
    ONCE EndTime                 = 080000            //End   of Asian session
    ONCE AsianSession            = 0
    ONCE hh                      = 0
    ONCE ll                      = 999999
    
    //                    set variables at the beginning of every Asian session
    IF (time >= StartTime) OR (time < EndTime) AND (AsianSession = 0) THEN
       AsianSession = 1
       hh           = 0
       ll           = 999999
    ENDIF
    
    //                    find Higher Highs and Lower Lows at each bar (while in the desired session) & colour Background
    IF AsianSession THEN
       hh = max(hh,high)
       ll = min(ll,low)
       backgroundcolor(220,220,220,255)              //Grey Background
    ENDIF
    
    //                    initialize variables at the end of every Asian session
    IF (time >= EndTime) AND (time < StartTime) AND AsianSession THEN
       AsianSession = 0
    ENDIF
    
    drawhline(hh)coloured(0,100,0,255)               //Dark green for the Highest High
    drawhline(ll)coloured(139,0,0,255)               //Dark Red   for the Lowest Low
    
    RETURN

    It will display a grey background so that the session it is clearly defined and displays two lines for the highest high and the lowest low.

    It’s up to you to adjust times and coloors to suit best your needs.

    Roberto

    Nicolas, withoutwings and klimasm thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Indicator to display Asian time zones


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
SSM1 @ssm1 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
7 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/24/2018
Status: Active
Attachments: 1 files
Logo Logo
Loading...