Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using DrawText under Draw.ArrowUp

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

    Using DrawText under Draw.ArrowUp

    Hello,

    I did some research and I know this topic come back from time to time.

    I did draw an arrow Up on my chart:

    Code:
    Draw.ArrowUp(this, "ClosestCandleArrow" + arrowTagCounter, false, adjustedBarIndex, value.candleValue, Brushes.Green);
    I am trying to draw text under each candle with:

    Code:
    Draw.Text(this, "VolumeRatioText" + arrowTagCounter, false, adjustedBarIndex, value.candleValue - 2 * TickSize, volumeRatio.ToString("P2"), Brushes.Green);
    Tried several versions:

    Code:
    Draw.Text(this, "VolumeRatioText" + arrowTagCounter, Brushes.Green, new Coord(adjustedBarIndex, value.candleValue - 2 * TickSize), volumeRatio.ToString("P2"), TextAlignment.Center, true, 10, "Arial", 8);
    Code:
    Draw.Text(this, "VolumeRatioText" + arrowTagCounter, Brushes.Green, new Coord(adjustedBarIndex, value.candleValue - 2 * TickSize), volumeRatio.ToString("P2"), TextAlignment.Center, true);

    Am i missing something like a parameter somewhere?

    I get those errors:


    1) NinjaScript File Error Code Line Column Gapoffset.cs Argument 3: cannot convert from 'bool' to 'string' CS1503 164 62

    2) NinjaScript File Error Code Line Column Gapoffset.cs Argument 6: cannot convert from 'string' to 'bool' CS1503 164 121

    3) NinjaScript File Error Code Line Column Gapoffset.cs Argument 7: cannot convert from 'System.Windows.Media.SolidColorBrush' to 'string' CS1503 164 149

    Frank
    TY

    #2
    Hello frankduc,

    Thank you for your post.

    It looks like you are not supplying the correct arguments in your Draw.Text() call. The errors suggest you are supplying a bool when it is expecting a string, a string when it is expecting a bool, and a Brush when it is expecting a string.

    Below are the valid overloads for Draw.Text():

    Draw.Text(NinjaScriptBase owner, string tag, string text, int barsAgo, double y)

    Draw.Text(NinjaScriptBase owner, string tag, string text, int barsAgo, double y, Brush textBrush)

    Draw.Text(NinjaScriptBase owner, string tag, string text, int barsAgo, double y, bool isGlobal, string templateName)

    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)

    Draw.Text(NinjaScriptBase owner, string tag, bool isAutoScale, string text, DateTime time, double y, int yPixelOffset, Brush textBrush, SimpleFont font, TextAlignment alignment, Brush outlineBrush, Brush areaBrush, int areaOpacity)


    The below will through errors as you are supplying what is likely a number (adjustedBarIndex) when this overload calls for a string argument (string text), then you are suppling what is likely a double value for the barsAgo argument, then a string for the integer yPixelOffset, then a brush which is correct but you are missing the rest of the arguments (TextAlignment, outlineBrush, areaBrush, areaOpacity).

    Draw.Text(this, "VolumeRatioText" + arrowTagCounter, false, adjustedBarIndex, value.candleValue - 2 * TickSize, volumeRatio.ToString("P2"), Brushes.Green);

    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)


    It seems like you are mixing up the different overloads. I suggest picking one overload, and one by one supplying the correct parameter as outlined in the overload parameters. ​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    557 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 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
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X