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

How can I put a logo in NT charts?

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

    How can I put a logo in NT charts?

    Hello folks,

    I'd like to add a logo on the top-left section of NT charts (please, see image attached). I have a PNG image. Is there a tool in NT to place it directly or do I have to program it?

    Thanks for your help,
    luiscristhian97

    Click image for larger version

Name:	Company logo on NT.png
Views:	1423
Size:	118.1 KB
ID:	1038587


    #2
    Hello luiscristhian97,
    Thanks for your post.

    There is currently no way to achieve this through the NinjaTrader UI. This can be done with some custom programming by using SharpDX and drawing an image within OnRender().

    Although created for bitmaps and not for PNG's, we do have sample code that you can reference for how to do this. I will attach the sample to my post. There is also a sample indicator named "SampleCustomRender" you can find inside the NinjaScript editor.

    Let me know if you have any questions.

    EDIT: See post #9 for an example
    Last edited by NinjaTrader_Jim; 10-12-2021, 02:09 PM.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Hello Josh,

      Thanks for your reply.

      I could set your SampleDrawBitmap file as an indicator in NT8. Then, I was trying to load my logo from a png file with SharpDX, but without success. Is there a way to do that in NinjaScript?

      Thanks again Josh

      Comment


        #4
        luiscristhian97,

        What specifically have you tried?
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Hello Josh,

          Here's the section of the code that I think can be the key of all of this.

          Code:
          public override void OnRenderTargetChanged()
                  {
                      myBitmap = LoadBitmapFromContentFile(System.IO.Path.Combine(NinjaTrader.Core.Globals.UserDataDir, "LOGO.png"));
                  }
          I was trying to get my LOGO.png into this path "LoadBitmapFromContentFile(System.IO.Path.Combine(N injaTrader.Core.Globals.UserDataDir, "LOGO.png"))", so it can show up when I activate the indicator on the chart.

          Went to Documents > NinjaTrader 8 > bin > Custom > Indicators and pasted my LOGO.png in that folder, but I think it's not as simple as that.

          Comment


            #6
            luiscristhian97,

            The "LOGO.png" file will not be inside the \Documents\NinjaTrader 8\bin\Custom\Indicators\ folder
            It would go directly inside the User Data Directory. ie. \Documents\NinjaTrader 8\
            Josh G.NinjaTrader Customer Service

            Comment


              #7
              Thank you Josh!

              Comment


                #8
                HI, I've been trying to use it. when I load the indicator, I can see the logo in the middle. But as soon as I reload ninjascript or move sideways too much or try to open Ninjascript, the whole ninjatrader crashes. What could be the issue behind it?

                Comment


                  #9
                  Hello fawzanalim,

                  Please try the attached version which has some changes and cleanups.
                  Attached Files
                  JimNinjaTrader Customer Service

                  Comment


                    #10
                    Hello,
                    Is it possible to define that the drawn bitmap/image is placed "below/behind" the candles? Just adjusting the opacity is still distracting and I would like to place a Logo as an entire chart background.

                    Comment


                      #11
                      Originally posted by Human#102 View Post
                      Hello,
                      Is it possible to define that the drawn bitmap/image is placed "below/behind" the candles? Just adjusting the opacity is still distracting and I would like to place a Logo as an entire chart background.
                      Hello Human#102,

                      Thanks for your note.

                      This can be done by setting the Z-Order with SetZOrder():


                      More details on ZOrder indexes may be found here:


                      You could also manually modify Z-Order of objects on a chart as described here:


                      The following indicator is publicly available on our NinjaTrader Ecosystem website and it uses SetZOrder() to ensure that the instrument name is rendered behind the chart bars:
                      Here is a basic guideline of how to import NinjaScript add-ons in NinjaTrader 8:

                      Note — To import NinjaScripts you will need the original .zip file.

                      To Import:
                      1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
                      2. From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
                      3. Select the downloaded .zip file
                      4. NinjaTrader will then confirm if the import has been successful.

                      Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

                      Once installed, you may add the indicator to a chart by:
                      • Right-click your chart > Indicators... > Select the Indicator from the 'Available' list on the left > Add > OK

                      Here is a short video demonstration of the import process:
                      Please let me know if I can be of further assistance.

                      The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
                      Emily C.NinjaTrader Customer Service

                      Comment


                        #12
                        Hi NinjaTrader_Emily ,
                        thank you for this detailed and prompt response. Unfortunately I'm now facing two other issues.
                        1. I only now realize that objects drawn like that are "interactable". Which means that for one a double click onto that opens the strategies window, but more importantly, dragging the chart doesn't work when I do so while the mouse is over the image.
                        2. All other plots and drawn objects also appear on that Order.
                        Is there a way to make the drawn object "unclickable", allowing the chart to be dragged as well, and would it be perhaps possible to set the Z-Order of the drawn object specifically, and not the entire strategy?
                        A different idea I've had was to maybe create an indicator, solely for this purpose, and add this to the chart through the strategy. This solution would solve the second issue I've described, but then I need to "hide" such indicator from the indicator selection menu/window. The only way I know of how to "hide" indicators or strategies is by making them abstract, but here I do need an actual class for the implementation. (The first issue would still remain.)

                        I really hope that there is some solution to this because this would be a huge help in terms of branding and customization.

                        Best regards,
                        A fellow human

                        Comment


                          #13
                          Hello fellow human,

                          Thank you for your reply. Those are good points.

                          You could use the IsInHitTest property to determine whether the object is "clickable" or not:


                          For example, in the watermark script I shared as well as in the SampleCustomRender indicator that comes with NinjaTrader, they have logic within the following condition:
                          Code:
                          if (!IsInHitTest)
                          In the sample bitmap script, you could modify it as follows:
                          Code:
                                      if (!IsInHitTest)
                                      RenderTarget.DrawBitmap(myBitmap, new SharpDX.RectangleF((float)ChartPanel.W / 2, (float)ChartPanel.H / 2, 150, 150), 1.0f, SharpDX.Direct2D1.BitmapInterpolationMode.Linear);​
                          Or you could consider adding a return statement inside of OnRender() if IsInHitTest is true to achieve the same result:
                          Code:
                          if (IsInHitTest)
                          return;
                          This should help you to achieve your goal whether you want to create the indicator separately or do the rendering within a strategy script.

                          Please don't hesitate to reach out with any other questions or concerns.
                          Emily C.NinjaTrader Customer Service

                          Comment


                            #14
                            Thank you very much, this indeed solved the issue with the interactable.
                            Any idea how to set the Z-Order of only the bitmaps, and leave all else default? Is it possible to set the Z-Order of such objects individually?

                            Comment


                              #15
                              Originally posted by Human#102 View Post
                              Thank you very much, this indeed solved the issue with the interactable.
                              Any idea how to set the Z-Order of only the bitmaps, and leave all else default? Is it possible to set the Z-Order of such objects individually?
                              Z-Order is modified for the object as a whole, such as a strategy object or indicator object. If you'd like a separate Z-Order for separate items, such as the bitmap/watermark and other items like draw objects, then it would be best to isolate your bitmap/watermark logic into its own script (such as an indicator). The indicator could have a Z-Order of -1, then your strategy could call AddChartIndicator() to add that indicator with a Z-Order of -1 while the strategy objects would be able to have a different Z-Order.

                              Please let us know if we may be of further assistance.
                              Emily C.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by jclose, Today, 09:37 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post jclose
                              by jclose
                               
                              Started by WeyldFalcon, 08-07-2020, 06:13 AM
                              10 responses
                              1,413 views
                              0 likes
                              Last Post Traderontheroad  
                              Started by firefoxforum12, Today, 08:53 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post firefoxforum12  
                              Started by stafe, Today, 08:34 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post stafe
                              by stafe
                               
                              Started by sastrades, 01-31-2024, 10:19 PM
                              11 responses
                              169 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Working...
                              X