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 futtrader, 04-21-2024, 01:50 AM
      4 responses
      41 views
      0 likes
      Last Post futtrader  
      Started by Option Whisperer, Today, 09:55 AM
      1 response
      11 views
      0 likes
      Last Post bltdavid  
      Started by port119, Today, 02:43 PM
      0 responses
      3 views
      0 likes
      Last Post port119
      by port119
       
      Started by Philippe56140, Today, 02:35 PM
      0 responses
      4 views
      0 likes
      Last Post Philippe56140  
      Started by 00nevest, Today, 02:27 PM
      0 responses
      2 views
      0 likes
      Last Post 00nevest  
      Working...
      X