Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help Draw image

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

    Help Draw image

    Hello.
    As it can be implemented in version 8?

    Thanks, Andrey I.

    public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
    {
    Image img = Image.FromFile(Environment.GetFolderPath(Environme nt.SpecialFolder.Personal) + \\logo.png");
    graphics.DrawImage(img, 1, 18, 50, 50);
    }

    #2
    Hello,

    Thank you for the question.

    Because NinjaTrader 8 now uses SharpDX, quite a lot has changed in regard to how you would Draw an image.

    I located a SharpDX sample of drawing an image specifically using Google: https://english.r2d2rigo.es/2014/08/...using-sharpdx/

    Most items you will research for SharpDX will not be specific to NinjaTrader so you would need to take whatever examples you find and review the logic used and only use exactly what is needed.

    This page linked to a git repo which contained a sample, I reviewed the sample and took only the critical parts from that sample and placed them in an indicator which is attached.
    https://github.com/r2d2rigo/Direct2D...iewProvider.cs

    NinjaTrader does most of the hard work so most of the sample was not used, only the loading the file and drawing were taken from the sample.

    For other NInjaTrader Specific examples of SharpDX, I would suggest reviewing the SampleCustomPlot indicator or any of the Drawing Tools that are in the NinjaScript editor as they all use OnRender.

    To run the sample, Import the indicator. After importing the indicator, place the attached image in the Documents\NinjaTrader 8 folder. The indicator is specifically looking for the User documents folder to load the image from file.

    Please let me know if I may be of further assistance.

    Attached Files
    Last edited by NinjaTrader_ChelseaB; 10-31-2022, 10:19 AM.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by alifarahani, Today, 09:40 AM
    6 responses
    31 views
    0 likes
    Last Post alifarahani  
    Started by Waxavi, Today, 02:10 AM
    1 response
    17 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by Kaledus, Today, 01:29 PM
    5 responses
    14 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Waxavi, Today, 02:00 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by gentlebenthebear, Today, 01:30 AM
    3 responses
    17 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X