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