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, Yesterday, 01:16 PM
    3 responses
    11 views
    0 likes
    Last Post cre8able  
    Started by ChartTourist, Today, 08:22 AM
    0 responses
    4 views
    0 likes
    Last Post ChartTourist  
    Started by LiamTwine, Today, 08:10 AM
    0 responses
    2 views
    0 likes
    Last Post LiamTwine  
    Started by Balage0922, Today, 07:38 AM
    0 responses
    5 views
    0 likes
    Last Post Balage0922  
    Started by JoMoon2024, Today, 06:56 AM
    0 responses
    6 views
    0 likes
    Last Post JoMoon2024  
    Working...
    X