Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DRAWREGION with 2 DataSeries Shifts when we look backwards

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

    DRAWREGION with 2 DataSeries Shifts when we look backwards

    I have a problem with using Drawregions and 2 DataSeries. It works fine with current day but if we move the chart backwards the colored regions shift and I do not know why. I post here the code and a pic.

    The regions should be +/- 2 TickSizes around the lines. Any idea about how to solve it?. Thanks in advanced...

    if (BarsInProgress != 0) return;
    if (CurrentBars[1]<30) return;
    if (CurrentBars[0]<30) return;

    double value1=PriorDayOHLC().PriorHigh[0];
    double value2=PriorDayOHLC().PriorLow[0];
    double value3 = Swing(BarsArray[1],5).SwingHigh[0];
    double value4 = Swing(BarsArray[1],5).SwingLow[0];
    Max2D.Set(value1);
    Min2D.Set(value2);
    SwingH30.Set(value3);
    SwingL30.Set(value4);
    MAX2Da.Set(value1+
    2*TickSize);
    MAX2Db.Set(value1-
    2*TickSize);
    DrawRegion(
    "MAXIMO 2 DIAS", CurrentBar, 0, MAX2Da, MAX2Db, Color.Green, Color.LimeGreen, 2);
    Attached Files

    #2
    Hello Sangui,
    To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

    Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

    I look forward to assisting you further.

    *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Sure I will do it now. Thanks

      Comment


        #4
        Hello Sangui,
        This is to confirm I have received your email and has replied back to it.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Everything goes well now. Thanks!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          581 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          338 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
          554 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