Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Indicator is not printing drawings on chart every day

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

    Custom Indicator is not printing drawings on chart every day

    Hello,

    I have created a indicator, mainly to serve as a visual aid in larger back-tests, that draws dots, texts and lines on key price points to show if specific patterns are forming.

    I have also written this indicator as a 'strategy' so that I may place it in a back-test to see if the logic is calculating correctly in the output window with prints. This has in fact shown that it does calculate correctly when patterns are found; however, the problem is that they only print on the chart in the last calculated instance from the loaded data.

    As shown below, I have loaded three days worth of data but it only printed on chart on the last day (green circle) when it also should have printed on chart on prior days as well (red circles).
    The blue diamond shows a cancellation, or where to stop monitoring for the forming pattern. In this case it only printed on day two. The output shows that the blue diamond should have also printed on day one which says "xxxxxx[87]DownMomentumMove is cancelled...."

    This is the syntax I used to draw the dots and texts on the chart. This sentence pair of logic also applies for all of my other prints and shapes on the chart.
    {
    Draw.Dot(this, "DownA", true, LegConsecutiveBars - 1, DownA, Brushes.Gold); //Marks dot on chart for DownA
    Draw.Text(this, "DownAtext", "DownA", LegConsecutiveBars - 1, DownA + 2, Brushes.LightBlue); //Marks text on chart for DownA
    }

    What may be the issue that prevents it from printing it every day on historical data?



    ​ Click image for larger version

Name:	Indicatorstrategy prints.png
Views:	350
Size:	394.8 KB
ID:	1215723

    #2
    Hello Don22Trader1,

    Thank you for your note.

    The issue is that you're not drawing the objects with unique tags, so when you go to draw a new object, it updates the old one to the new position instead of drawing a completely new object. Try adding the CurrentBar to the tags for each drawing object to make them unique:

    Code:
    Draw.Dot(this, "DownA" [B]+ CurrentBar[/B], true, LegConsecutiveBars - 1, DownA, Brushes.Gold); //Marks dot on chart for DownA
    Draw.Text(this, "DownAtext" [B]+ CurrentBar[/B], "DownA", LegConsecutiveBars - 1, DownA + 2, Brushes.LightBlue); //Marks text on chart for DownA
    ​Please let us know if we may be of further assistance to you.

    Comment


      #3
      NinjaTrader_Kate,

      Yes, that fixed my problem.

      Thank you

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      77 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      109 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      57 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      108 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      65 views
      0 likes
      Last Post PaulMohn  
      Working...
      X