Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.region

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

    Draw.region

    Hello, I would like to replace my two lines with a region and my sentence does not give me error but it does not draw anything, any suggestion, with indicator Bollinger it's works, but no my region,

    I use this code for Convert double en ISeries

    private Series<double> upperSeries; private Series<double> lowerSeries; protected override void OnStateChange() { if (State == State.SetDefaults) { AddPlot(Brushes.Transparent, "UpperRegion"); // Series de referčncia AddPlot(Brushes.Transparent, "LowerRegion"); } else if (State == State.DataLoaded) { upperSeries = new Series<double>(this); lowerSeries = new Series<double>(this); } } protected override void OnBarUpdate() { // Emmagatzema els valors d'Open i Close en una Series upperSeries[0] = Math.Max(Open[0], Close[0]); lowerSeries[0] = Math.Min(Open[0], Close[0]); // Dibuixa la regió entre Open i Close Draw.Region(this, "DeltaReg" + CurrentBar, false, upperSeries, lowerSeries, null, Brushes.Blue, 50); }



    Draw.Line(this, CurrentBar + ".DeltalineUp", false, 0, Open[0], power*-1, Open[0], Brushes.DarkGreen, DashStyleHelper.DashDotDot,2);
    Draw.Line(this, CurrentBar + ".DeltalineUpl", false, 0, Close[0], power*-1, Close[0], Brushes.DarkGreen, DashStyleHelper.DashDotDot, 2);


    //Draw.Region(this, "DeltaReg", CurrentBar, 0, Bollinger(Close[0], 14).Upper, Bollinger(Open[0], 14).Lower, null, Brushes.Blue, 50); this is code NT8 copy to link and work

    Draw.Region(this, "DeltaReg", CurrentBar, 0, upperSeries, lowerSeries, null, Brushes.Blue, 50); No Draw

    Draw.Region(this, CurrentBar + ".DeltalineUp", 0, 0, upperSeries, lowerSeries, null, Brushes.Blue, 50); No Draw

    PlaySound(@"C:\Program Files\NinjaTrader 8\sounds\Delta_Diverg.wav");



    #2
    Hi I use Draw.Rectangle() is more easiy.

    Draw.Rectangle(this, CurrentBar + ".DeltaRectUp", false, 10, Low[0] - TickSize, -80, High[0] + TickSize, Brushes.PaleVioletRed, Brushes.PaleVioletRed, 2);
    Last edited by fersanmito; 02-27-2025, 08:27 AM.

    Comment


      #3
      Hello,

      Thank you for your post.

      To understand why the script is behaving as it is, such as placing orders or not placing orders or drawing objects when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

      In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition.

      The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

      The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.

      Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

      I am happy to assist you with analyzing the output from the output window.

      Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

      Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.

      https://support.ninjatrader.com/s/ar...nd-TraceOrders

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      553 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      100 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      543 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      546 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X