Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

previous hight low

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

    previous hight low

    I want create a script in NT8, this script paint horizontal line with the hight and low price of yesterday, the script fails and i couldnt resolve this,

    protected override void OnBarUpdate()
    {
    if (Bars.IsFirstBarOfSession && CurrentBar > 0)
    {
    DateTime currentSessionDate = Time[0].Date;

    if (lastDayProcessed != currentSessionDate)
    {
    previousDayHigh = High[HighestBar(High, CurrentBar - 1)];
    previousDayLow = Low[LowestBar(Low, CurrentBar - 1)];
    lastDayProcessed = currentSessionDate;

    // Elimina las líneas anteriores si existen
    RemoveDrawObject("PreviousDayHighLine");
    RemoveDrawObject("PreviousDayLowLine");

    // Dibuja las nuevas líneas horizontales
    Draw.Line(this, "PreviousDayHighLine", 0, previousDayHigh, -20, previousDayHigh, Brushes.Orange);
    Draw.Line(this, "PreviousDayLowLine", 0, previousDayLow, -20, previousDayLow, Brushes.Orange);
    }
    }
    }


    Thanks!!

    #2
    Hello dcriador,

    Thank you for your post.

    In what way is the script failing? Is there unexpected behavior, if so please describe the behavior in detail.

    Are there errors in the Log tab of the Control Center?

    You can use the PriorDayOHLC() indicator to get the high and the low of the previous session.



    Please note your script is removing the same drawing object and redrawing it on each pass of OnBarUpdate(). Is this what you are looking to do?

    I look forward to your response.

    Comment


      #3
      Draw not exist in current context
      Click image for larger version

Name:	image.png
Views:	54
Size:	62.0 KB
ID:	1287161

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      56 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      133 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X