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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        36 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        14 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        19 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X