Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Line is displayed later than expected

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

    Draw.Line is displayed later than expected


    I am trying to draw lines that paint from the previous bar to the current bar, but they always paint from 2 barsAgo to 1 barsAgo.
    My indicator "Displacement" is set to 0.
    I have verified that the code is positioned in OnBarUpdate() within the braces where activeBar is equal to CurrentBar.
    It is acting as though the code is sitting inside the code area where (CurrentBar != activeBar), but it is not located there.

    Any advice will be greatly appreciated.

    protected override void OnBarUpdate()
    {
    if (CurrentBar != activeBar)
    {
    activeBar = CurrentBar;
    }

    if(BidVolume0 >= bidHighLevel) {Draw.Line(this, "bidTag0" + CurrentBar, false, 1, bidPrice0, 0, bidPrice0, Brushes.LightSeaGreen, DashStyleHelper.Solid, lineWidth, true); }

    }​​

    #2
    Hello goodknight777,

    Are you using OnEachTick or OnPriceChange? If you are using OnBarClose that would likely be expected however this may also relate to the condition you are using. You could use a Print to verify when the condition becomes true to see if the result is expected.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    576 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    553 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X