Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Vertical Line

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

    Vertical Line

    OK, this one seems like it should be pretty easy/obvious, but it's not.

    Created a basic strategy in Strategy Builder to draw a vertical line on a 5-minute chart wherever the close was higher than the open. (This was just for testing, because I haven't been able to get the vertical line to work on anything and figured I'd start out with the most basic conditions)

    It draws one vertical line, on the most recent bar that meets the criteria, and that's it. Every single other drawing object will draw on every bar that meets the criteria as far back as the bars go.

    What's wrong here? This is Strategy Builder syntax, unmodified:

    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 0)
    return;

    // Set 1
    if (Close[0] > Open[0])
    {
    Draw.VerticalLine(this, @"VerticalLine Vertical line_1", 0, Brushes.Lime, DashStyleHelper.Solid, 2);
    }​

    Click image for larger version

Name:	image.png
Views:	408
Size:	608.5 KB
ID:	1253035

    #2
    Hello LunaKai,

    That is because of the tag you used. You need to click in the tag field and click Set to bring up the string builder window. In that window you can type in the string you have, in the following field click Set and then choose Misc -> CurrentBar. That will make unique tags so you aren't updating 1 object each time the condition is true.

    Comment


      #3
      That did it. I'd been using ArrowDown and so forth from other Strategy examples and they were working just fine...now I know that's because they modified each bar's tag.

      Thanks much!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      101 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      156 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      84 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      57 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      73 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X