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 lorem, Yesterday, 09:18 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by WHICKED, Today, 12:56 PM
    2 responses
    15 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Started by Felix Reichert, Today, 02:12 PM
    0 responses
    1 view
    0 likes
    Last Post Felix Reichert  
    Started by Tim-c, Today, 02:10 PM
    0 responses
    1 view
    0 likes
    Last Post Tim-c
    by Tim-c
     
    Started by cre8able, Today, 01:16 PM
    2 responses
    9 views
    0 likes
    Last Post cre8able  
    Working...
    X