Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing A Price Marker to the right of the last bar

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

    Drawing A Price Marker to the right of the last bar

    Hi,

    I am trying to figure out how to make a price marker that will present itself to the right of the bar... Here is an attempt, with issues (code is in OnBarUpdate.. I know i shouldn't create the font each time it fires, but this is just an example..)

    Code:
    	NinjaTrader.Gui.Tools.SimpleFont MarkerFont = new NinjaTrader.Gui.Tools.SimpleFont("WingDings 3", 12)
                {
                    Size = 31, 
                    Bold = true
                };
    			Draw.Text(this, "PriceMarker", true, "t", Time[0].AddHours(1),  Close[0], 0, Brushes.Cyan, MarkerFont, TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 0);
    This works fine on an hourly chart, but not well on a tick chart. Of course, on time based charts I figure I must determine the time frame of the chart and move the Time[0] forward to the time duration of a given bar. However, on tick charts, it wont be feasible, hence I am asking for a better solution, if you have one.

    Thank you.

    #2
    Originally posted by KhaosTrader View Post
    Hi,

    I am trying to figure out how to make a price marker that will present itself to the right of the bar... Here is an attempt, with issues (code is in OnBarUpdate.. I know i shouldn't create the font each time it fires, but this is just an example..)

    Code:
    	NinjaTrader.Gui.Tools.SimpleFont MarkerFont = new NinjaTrader.Gui.Tools.SimpleFont("WingDings 3", 12)
                {
                    Size = 31, 
                    Bold = true
                };
    			Draw.Text(this, "PriceMarker", true, "t", Time[0].AddHours(1),  Close[0], 0, Brushes.Cyan, MarkerFont, TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 0);
    This works fine on an hourly chart, but not well on a tick chart. Of course, on time based charts I figure I must determine the time frame of the chart and move the Time[0] forward to the time duration of a given bar. However, on tick charts, it wont be feasible, hence I am asking for a better solution, if you have one.

    Thank you.
    Use the overload that uses barsAgo, and use a negative bar index for the start of your text object.

    Comment

    Latest Posts

    Collapse

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