Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawtextfixed

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

    Drawtextfixed

    Hi there.

    I am am trying to convert my NT7 drawtextfixed code to NT8. Simple example:

    Draw.TextFixed(this, "tag 2",(Open[0]-Close[0].ToString("N0")), TextPosition.TopRight, BarBrush = Brushes.Blue, _newsHeadingFont, BarBrush = Brushes.Red, BarBrush = Brushes.DarkGreen, 100);



    I am getting the following error - The error says this relates to < or > <- etc so no sure of the problem. It looks like it doesn't like the Open[0] - Close [0] part. Thanks in advance!
    TimerIndicator.cs Operator '-' cannot be applied to operands of type 'double' and 'string' CS0019 140 33

    #2
    Hello djkiwi,

    Thanks for your post.

    The compiler error is telling you that you are improperly trying to use the subtraction operator between a double and a string. A string is a text variable and would not be subtracted from a double which has decimal values.

    Please check where you are trying to perform subtraction between a string and a double to see where the error is at.

    Hint: (Open[0]-Close[0].ToString("N0"))

    Did you meant to do this instead? (Open[0]-Close[0]).ToString("N0")

    Some basic programming concepts can be found below and more robust C# programming materials can be found externally to NinjaTrader.

    Basic Programming Concepts - https://ninjatrader.com/support/help...g_concepts.htm

    We look forward to assisting.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    52 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    71 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    38 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    99 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    60 views
    0 likes
    Last Post PaulMohn  
    Working...
    X