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 sjsj2732, Yesterday, 04:31 AM
      0 responses
      27 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      283 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      280 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      131 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      90 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X