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. ​

    Gaby V.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by manitshah915, 12-12-2024, 09:39 AM
    2 responses
    49 views
    0 likes
    Last Post Herry
    by Herry
     
    Started by ntsomeone, Today, 07:47 AM
    0 responses
    7 views
    0 likes
    Last Post ntsomeone  
    Started by RJBen, 01-24-2025, 02:39 PM
    2 responses
    12 views
    0 likes
    Last Post RJBen
    by RJBen
     
    Started by ilaniko, Today, 06:22 AM
    0 responses
    9 views
    0 likes
    Last Post ilaniko
    by ilaniko
     
    Started by GeorgeW, 01-12-2025, 11:59 AM
    4 responses
    46 views
    0 likes
    Last Post GeorgeW
    by GeorgeW
     
    Working...
    X