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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    48 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    30 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    99 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    177 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    170 views
    0 likes
    Last Post CarlTrading  
    Working...
    X