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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        44 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        54 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        34 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        95 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        57 views
        0 likes
        Last Post PaulMohn  
        Working...
        X