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

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
    Chris L.NinjaTrader Customer Service

    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
        Chris L.NinjaTrader Customer Service

        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.
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by andrewtrades, Today, 04:57 PM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by chbruno, Today, 04:10 PM
            0 responses
            3 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Started by josh18955, 03-25-2023, 11:16 AM
            6 responses
            436 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            6 views
            0 likes
            Last Post FAQtrader  
            Started by rocketman7, Today, 09:41 AM
            5 responses
            19 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X