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

Strategy chart active screen

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

    Strategy chart active screen

    Hello again, could you help me with a small problem?

    I want to save an image of the chart where a strategy is activated, but in a chart with several tabs, with this method it sends me the active tab, is it possible to send the chart where the active strategy is and not the tab that is visible?​





    public static class ScreenShot
    {
    public static void SaveChart(ChartControl cc)
    {
    try
    {
    cc.Dispatcher.InvokeAsync(()=>{
    Chart chart = Window.GetWindow(cc) as Chart;
    RenderTargetBitmap screenCapture = chart.GetScreenshot(ShareScreenshotType.Chart);
    System.Windows.Media.Imaging.BitmapFrame outputFrame = BitmapFrame.Create(screenCapture);

    if (screenCapture != null)
    {
    try
    {
    PngBitmapEncoder png = new PngBitmapEncoder();
    png.Frames.Add(outputFrame);
    using (Stream stream = File.Create(string.Format(@"{0}\{1}", Core.Globals.UserDataDir, "TelegramImage.png"))) png.Save(stream);
    }
    catch (IOException)
    {
    NinjaTrader.Code.Output.Process("ScreenshotTakerEx ample: Could not take screenshot", PrintTo.OutputTab1);
    }
    }
    });
    }
    catch (Exception ex)
    {
    NinjaTrader.Code.Output.Process("Could not save screenshot " + ex, PrintTo.OutputTab1);
    }
    }

    }​

    #2
    Hi Ruben, thanks for writing in. Unfortunately, It would not be possible to capture graphics from an inactive tab since the graphics are no longer rendered when the tab is not selected. The chart tab must be visible to capture the render target contents.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thank you very much, as always you are a great help, I will discard this one and I will be able to continue working on something else.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by elirion, Today, 09:32 PM
      0 responses
      3 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by cre8able, Today, 09:15 PM
      1 response
      7 views
      0 likes
      Last Post bltdavid  
      Started by cummish, Today, 08:43 PM
      0 responses
      12 views
      0 likes
      Last Post cummish
      by cummish
       
      Started by Option Whisperer, Today, 07:58 PM
      4 responses
      21 views
      0 likes
      Last Post Option Whisperer  
      Started by ETFVoyageur, 05-07-2024, 07:05 PM
      13 responses
      87 views
      0 likes
      Last Post ETFVoyageur  
      Working...
      X