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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    35 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    12 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    18 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X