Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing objects inside Indicator

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

    Drawing objects inside Indicator

    Hi. I'm developing and indicator, to give me signals of entry into the market. The problem that i have is taht the objects are drawing every tick. So some times the draw a lot of objects insede the bar.

    The code is:

    protected override void OnBarUpdate() // executed every tick...It's necessary that condition everytick....If the condition it's true I would like to draw just one time... //
    {



    if (condition))
    {

    contador++;
    //Print("WA"+Time[0].ToShortTimeString());
    Draw.ArrowUp(this, contador.ToString(), false, 0, Low[0]-2,Brushes.GreenYellow);
    contador++;
    Draw.Text(this, contador.ToString(), "WA", 0, Low[0]-10, Brushes.GreenYellow);
    }

    //
    else if (condition)
    {
    contador++;
    //Print("WB"+ Time[0].ToShortTimeString());
    Draw.ArrowUp(this, contador.ToString(), false, 0, Low[0]+2, Brushes.Red);
    contador++;
    Draw.Text(this, contador.ToString(), "WA", 0, Low[0]+10, Brushes.Red);
    }


    else if(condition))
    {
    contador++;
    //Print("SA"+ Time[0].ToShortTimeString());
    Draw.Text(this, contador.ToString(), "SA", 0, Low[0]-2,Brushes.YellowGreen);
    }


    else if(condition))
    {
    contador++;
    //Print("SB"+ Time[0].ToShortTimeString());
    Draw.Text(this, contador.ToString(), "SB", 0, Low[0]+2, Brushes.Red);
    }


    else if(condition))
    {
    contador++;
    //Print("OK_Under"+ Time[0].ToShortTimeString());
    Draw.Text(this, (contador).ToString(), "OK", 0, Low[0]+6);
    }


    else if(condition))
    {
    contador++;
    //Print("OK_over"+ Time[0].ToShortTimeString());
    Draw.Text(this, (contador).ToString(), "OK", 0, Low[0]-6);
    }

    }

    #2
    I have fixed the problem.. Just adding this lien of code:

    if(condition && currentBar!=CurrentBar)
    {
    currentBar = CurrentBar; // so if the same bar, doesn't draw the object again...

    }


    Thanks..


    Comment


      #3
      Hello brokerbombero,

      Thanks for the post.

      I'm glad you were able to find the issue here.

      Please let me know if there is anything I can assist with.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 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
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X