Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawRegion - start & end at specific time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    DrawRegion - start & end at specific time

    Hi all;

    I have used 'DrawRegion' to fill between two plots but I want the fill to start and end at specific times. I have done the following:

    In the 'Initialize' I have:

    private DateTime zonestart;
    private DateTime zoneend;

    'OnBarUpdate'

    zonestart = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 08, 30, 0);
    zoneend = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 15, 14, 0);

    DrawRegion("Zone", zonestart, zoneend, HighestHigh, LowestLow,Color.Empty, Color.Blue, opacity);

    I still have my plots/dataseries on the chart that I want to fill between but no fill. If I use '0' and 'CurrentBar' instead of 'zonestart' etc I get a fill but it doesn't terminate until midnight. The help file isn't particularly helpful as it only gives an example for 'BarsAgo'. I have tried putting in the times '083000' and '151400' but that doesn't work either. Also tried turning these into integers with 'int zonestartBarsAgo = GetBar(zonestart);' This didn't work either.

    What is the obvious answer I am missing please.

    Thanks;

    Ben.

    #2
    Hello Ben,
    Thanks for writing in and I am happy to assist you.

    If you change the code to as below can you get the right fill.
    Code:
    this.DrawRegion("tag" + Time[0].Date.ToString(), zonestart, zoneend, Upper, Lower, Color.Blue, Color.Blue, 3);
    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks for your help ! Works perfectly.

      Comment


        #4
        Hello Ben,
        Glad to know everything is working fine at your end.

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        589 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        342 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        555 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X