Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawDot not printing historically

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

    DrawDot not printing historically

    I cannot figure out how to get my DrawDot to show for all historical bars. It only shows a dot for the current bar.

    protected override void Initialize()
    {

    CalculateOnBarClose = false;
    DrawOnPricePanel = false;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Condition set 1

    if (EMA(34)[0] > SMA(50)[0]
    && EMA(34)[0] > EMA((int) (EMA(50)[0]))[0]
    && SMA(50)[0] > EMA((int) (EMA(50)[0]))[0])
    {
    DrawDot("tag1", true, 0, 0, Color.Lime);
    }

    #2
    Hello meandthetrio,

    To have this draw on historical bars you would need to use a unique Tag for each new drawing. Here is an example using the CurrentBar to accomplish that:

    Code:
    DrawDot([B]"tag1" + CurrentBar[/B], true, 0, 0, Color.Lime);
    In your sample you are just updating the same object over and over which is why it ends up on the CurrentBar.

    I look forward to being of further assistance.

    Comment


      #3
      Thank you that did the trick. Now however, the dots will not print when my moving averages become much farther apart although they do successfully print after a cross.

      protected override void Initialize()
      {

      CalculateOnBarClose = false;
      DrawOnPricePanel = false;
      }

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate()
      {
      // Condition set 1

      if (EMA(34)[0] > SMA(50)[0]
      && EMA(34)[0] > EMA((int) (EMA(50)[0]))[0]
      && SMA(50)[0] > EMA((int) (EMA(50)[0]))[0])
      {
      DrawDot("tag1" + CurrentBar, true, 0, 0, Color.Lime);
      }

      // Condition set 2

      if (EMA(34)[0] < SMA(50)[0]
      && EMA(34)[0] < EMA((int) (EMA(50)[0]))[0]
      && SMA(50)[0] < EMA((int) (EMA(50)[0]))[0])
      {
      DrawDot("tag1" + CurrentBar, true, 0, 0, Color.Red);
      }
      }

      Comment


        #4
        Hello meandthetrio,

        I believe you are running into the same problem here, you have reused the name "tag1" for the second object. If you mean to have both red and lime colored dots you would need to use unique names:

        Code:
        DrawDot("[B]LimeDot[/B]" + CurrentBar, true, 0, 0, Color.Lime);
        
        DrawDot("[B]RedDot[/B]" + CurrentBar, true, 0, 0, Color.Red);

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        663 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        376 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        110 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        580 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X