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 cre8able, 02-11-2023, 05:43 PM
    3 responses
    236 views
    0 likes
    Last Post rhubear
    by rhubear
     
    Started by frslvr, 04-11-2024, 07:26 AM
    8 responses
    113 views
    1 like
    Last Post NinjaTrader_BrandonH  
    Started by stafe, 04-15-2024, 08:34 PM
    10 responses
    46 views
    0 likes
    Last Post stafe
    by stafe
     
    Started by rocketman7, Today, 09:41 AM
    3 responses
    11 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by traderqz, Today, 09:44 AM
    2 responses
    10 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X