Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw a Dot exactly on a cross

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

    Draw a Dot exactly on a cross

    Dear everyone,

    I have an Indicator with a cross strategy.
    Whenever the two plots are crossing I would like to mark the cross with a dot.

    Unfortunetely the dots are always a bit moved due to the reason, that the cross is sometimes nearer to the last bar and sometimes more in the middle.

    I use:


    if (CrossBelow(Wt1, Wt2, 1))
    {
    if (CurrentBar >= Bars.Count - DrawOnlyOnXLastBars)
    Draw.Dot(this, CurrentBar.ToString() + "_RedCross", true, Time[0], Wt1[0], Brushes.Red);
    };


    Is there a way to get the dot been drawn directly on the cross?

    Thanks in advance.

    Cheers

    Click image for larger version

Name:	2021-05-31 22_19_42-Chart - BBA_BTCUSD.png
Views:	258
Size:	16.8 KB
ID:	1158305
    Airwave
    NinjaTrader Ecosystem Vendor - Airwave

    #2
    Hello Airwave,

    Thanks for your post.

    "Is there a way to get the dot been drawn directly on the cross?" Not really and the reason why is because the plots are drawing straight lines that begin (time wise) from the center of the bar to the center (time wise) of the next bar. So it would be rare that they exactly cross at the center (time wise) of a bar. Your dots (and pretty much all drawing objects) will default to drawing at the center (time wise) of the bar. The center of the bar (time wise) is an actual data point (x axis) and the vertical location of the data point is the Y axis. The lines between the data point are straight lines

    In order to draw a dot on the exact cross you would need to know/determine the exact time (x axis) that they crossed as well as the exact Y value and then use the Draw method that allows you to specify the time. This would involve determining the rate of rise of each line and then looping through the small time between the center of the bars and projecting the lines looking for when they collide. It would be quite involved.

    Reference: https://ninjatrader.com/support/help.../?draw_dot.htm

    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