Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

no suitable method found to override

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

    no suitable method found to override

    I am trying to test this code on ninjascript but it doesn't run and it gives me an error "NinjaTrader.NinjaScript.Indicators.bitmapSamp le.I con': no suitable method found to override" anyone can help me advice what is the cause or what am I missing? thanks!

    namespace NinjaTrader.NinjaScript.Indicators
    {
    public class bitmapSample : Indicator
    {
    private object icon;
    BitmapImage iconBitmapImage = new BitmapImage();

    protected override void OnStateChange()
    {
    if (State == State.Configure)
    {
    Name = "bitmapSample";
    IsOverlay = true;

    // Set the BitmapImage's UriSource to the location of an image file
    iconBitmapImage.BeginInit();
    iconBitmapImage.UriSource = new Uri(NinjaTrader.Core.Globals.InstallDir + "templates/MyResources/icon.png");
    iconBitmapImage.EndInit();


    }
    }

    public override object Icon
    {
    get
    {
    try
    {
    // Instantiate a Grid on which to place the image
    Grid myCanvas = new Grid { Height = 16, Width = 16 };

    // Instantiate an Image to place on the Grid
    Image image = new Image
    {
    Height = 16,
    Width = 16,
    // Height = 24, Width = 24,
    Source = iconBitmapImage
    };

    // Add the image to the Grid
    myCanvas.Children.Add(image);
    icon = myCanvas;
    }
    catch (Exception)
    {
    Log("Error creating icon grid", Cbi.LogLevel.Error);
    throw;
    }
    return icon;
    }
    }
    }
    }
    Last edited by eloyguides1; 03-15-2021, 09:23 AM. Reason: ninjascript

    #2
    Hello, thanks for your post.

    That Icon object is to be used for DrawingTools, ChartStyles, and ShareService objects only. There are no icons for Indicator objects.

    Please let me know if I can assist any further.
    Attached Files

    Comment


      #3
      Nice thanks for the sample and now I know where I can use the Icon object! one more thing is it possible to have this image on plot like what "Draw.ArrowDown and Draw.ArrowUp" did?

      Comment


        #4
        Hello eloyguides1, thanks for your reply.

        Yes, first set DrawOnPricePanel to false and IsOverlay to false in State.SetDefault, then when you call any draw object (Draw.ArrowDown, Draw.ArrowUp, etc) they will show up on the indicator plot rather than the price panel plot.

        Best regards,
        -ChrisL

        Comment


          #5
          Chris what I'm trying to do is something like shown in the image. I assume that it's an "image icon" any help is much appreciated! thank you so much!

          Comment


            #6
            Hello, thanks for your reply.

            Those are likely drawn using SharpDX in the OnRender method. See the sections "// 1.6 - Simple Text Rendering" and "// 1.7 - Advanced Text Rendering" in the SampleCustomRender example indicator that exists in the platform for an example of using SharpDX to draw custom text to the chart.

            Please let me know if I can assist any further.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            558 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