Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Use Draw.Text to add text of a double variable on chart

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

    Use Draw.Text to add text of a double variable on chart

    Hello,

    I have a private variable that is a double (it is a price value from my chart which is generated depending on my entry conditions) which I want to add to my chart as text when the entry conditions appear.

    I think I need to use the Draw.Text syntax however as my variable is a double type and not string the command does not execute.

    Code:
    (Draw.Text(NinjaScriptBase owner, string tag, bool isAutoScale, string text, int barsAgo, double y, int yPixelOffset, Brush textBrush, SimpleFont font, TextAlignment alignment, Brush outlineBrush, Brush areaBrush, int areaOpacity))
    How can I convert the double variable to a string variable so that I can insert it into the line of code?

    Thanks,

    Neil

    #2
    Hello Neil,

    Thanks for your post.

    You could use .ToString() on your variable to convert the variable to a string. For example, see the sample code below.

    Code:
    double [B]closePrice[/B] = Close[0];
    
    Draw.Text(this, "tag1", [B]closePrice.ToString()[/B], 0, Low[0] - 10 * TickSize, Brushes.DodgerBlue);
    See this help guide documentation for more information about using .ToString(): https://ninjatrader.com/support/help...htsub=ToString

    Let me know if I may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by trilliantrader, Today, 03:01 PM
    2 responses
    17 views
    0 likes
    Last Post helpwanted  
    Started by ScottWalsh, Today, 06:52 PM
    2 responses
    16 views
    0 likes
    Last Post ScottWalsh  
    Started by cre8able, Today, 07:24 PM
    0 responses
    1 view
    0 likes
    Last Post cre8able  
    Started by Haiasi, Today, 06:53 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by ScottW, Today, 06:09 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X