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 bortz, 11-06-2023, 08:04 AM
    47 responses
    1,606 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    9 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    19 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    6 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    15 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X