• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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_Jesse; 06-09-2017, 10:16 AM. Reason: Updated sample
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by jleira, Today, 10:26 PM
    0 responses
    1 view
    0 likes
    Last Post jleira
    by jleira
     
    Started by wuileng, Today, 10:14 PM
    0 responses
    1 view
    0 likes
    Last Post wuileng
    by wuileng
     
    Started by mntemel, Today, 09:07 PM
    1 response
    9 views
    0 likes
    Last Post MojoJojo  
    Started by martyn73, Today, 08:22 PM
    0 responses
    9 views
    0 likes
    Last Post martyn73  
    Started by RobertoPaez, Today, 08:13 PM
    0 responses
    4 views
    0 likes
    Last Post RobertoPaez  
    Working...
    X