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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    578 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X