• 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

screenshot share

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

    screenshot share

    when i share via twitter using indicator, i cannot send screenshots. is there a solution/feature planned for this?

    #2
    Hello,

    Are you looking to share a screenshot of your entire monitor, or are you running into trouble with the Share > Window feature specifically? There is currently not a full-monitor image sharing feature built-in directly in NinjaTrader 8, but the Share > Window feature should share a screenshot of your entire chart.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      Originally posted by NinjaTrader_Dave View Post
      Hello,

      Are you looking to share a screenshot of your entire monitor, or are you running into trouble with the Share > Window feature specifically? There is currently not a full-monitor image sharing feature built-in directly in NinjaTrader 8, but the Share > Window feature should share a screenshot of your entire chart.
      just want to share my window. do you have an example of how i can programatically do it from my indicator?

      Comment


        #4
        Absolutely. Take a look at the documentation for the Share() method below:

        http://ninjatrader.com/support/helpG...-us/?share.htm

        There is an example of sharing a screenshot to Twitter on that page, which should do the trick for you.
        Dave I.NinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_Dave View Post
          Absolutely. Take a look at the documentation for the Share() method below:

          http://ninjatrader.com/support/helpG...-us/?share.htm

          There is an example of sharing a screenshot to Twitter on that page, which should do the trick for you.
          maybe i did not identify my question correctly. is there any programatic feature to take a screenshot of the chart window as part of indicator? I would need this to use the share feature to twitter?

          Comment


            #6
            This seems like the best thread to highjack

            I am trying to create a screenshot of the chart using the below code but the file is just saving as blank. Can anyone tell me why this is? Is the ChartControl the correc object to be passing? This is the way I did it in NT7 but maybe I need to be passing a window object of some sort or something?

            Code:
            		protected override void OnBarUpdate()
            		{
            		
            			if (CurrentBar < Count -2)return;
            
            			this.Dispatcher.Invoke((Action)(() =>
            		    {
            		        if (!ScreenShotSaved){
            					CreateBitmapFromVisual(ChartControl,"d:\\test2.png");
            					Print("Just DOne");
            					ScreenShotSaved = true;
            				}
            		    }));
            			
            		}
            		
            		
            		public static void CreateBitmapFromVisual(ChartControl target, string fileName)
            	    {
            	        if (target == null || string.IsNullOrEmpty(fileName))
            	        {
            	            return;
            	        }
            
            	        Rect bounds = VisualTreeHelper.GetDescendantBounds(target);
            
            	        RenderTargetBitmap renderTarget = new RenderTargetBitmap((Int32)bounds.Width, (Int32)bounds.Height, 96, 96, PixelFormats.Pbgra32);
            
            	        DrawingVisual visual = new DrawingVisual();
            
            	        using (DrawingContext context = visual.RenderOpen())
            	        {
            	            VisualBrush visualBrush = new VisualBrush(target);
            	            context.DrawRectangle(visualBrush, null, new Rect(new Point(), bounds.Size));
            	        }
            
            	        renderTarget.Render(visual);
            	        PngBitmapEncoder bitmapEncoder = new PngBitmapEncoder();
            	        bitmapEncoder.Frames.Add(BitmapFrame.Create(renderTarget));
            	        using (Stream stm = File.Create(fileName))
            	        {
            	            bitmapEncoder.Save(stm);
            	        }
            	    }

            Comment


              #7
              Take a look at the attached script, which may shed some light on how to tweak your code. This sample starts off similarly to your code, but takes a different approach to capturing and saving the actual image.
              Attached Files
              Last edited by NinjaTrader_DaveI; 01-26-2016, 03:39 PM.
              Dave I.NinjaTrader Product Management

              Comment


                #8
                Originally posted by NinjaTrader_Dave View Post
                Take a look at the attached script, which may shed some light on how to tweak your code. This sample starts off similarly to your code, but takes a different approach to capturing and saving the actual image.
                you guys are just 1 click away from making this a built in function
                As we expect this to be part of the core product?

                Comment


                  #9
                  Thanks Dave, This works fine.

                  For anyone interested, here is my adapted version which saves to memory stream then attaches to an email and sends.

                  I have tested this using Gmail and works fine
                  Attached Files

                  Comment


                    #10
                    Originally posted by NinjaTrader_Dave View Post
                    Take a look at the attached script, which may shed some light on how to tweak your code. This sample starts off similarly to your code, but takes a different approach to capturing and saving the actual image.
                    I just noticed that if the tab that the chart exists on is not selected, the screenshot comes though of the highlighted chart at that time. How do we get the image of the chart running the indicator rather than the current screen image?

                    Cheers.

                    Comment


                      #11
                      Hi Guys,

                      Still hoping for an answer on this one. The screenshot comes through of whichever chart tab is selected at the time. How do you get the screen capture of the chart even though it may not be the active tab at the time?

                      Comment


                        #12
                        There will not be a way to do this using the methodology I shared below. Taking an image captures what is actually being rendered to the screen, and there is no such rendering occurring in an inactive tab. In an inactive tab, your script will have access to the underlying data used to construct a chart, but no actual rendered objects to capture.
                        Dave I.NinjaTrader Product Management

                        Comment


                          #13
                          OK, is there a way to programatically select the tab in question?

                          Comment


                            #14
                            Not currently, although that is an interesting idea. I'd be happy to write up a feature request for the ability to determine which tab is visible/selected via NinjaScript, if you'd like.
                            Dave I.NinjaTrader Product Management

                            Comment


                              #15
                              Would be nice to see which tab is visible / selected and possibly select one that is visible but not selected so that snapshot could be sent once it is selected.
                              Thanks

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by frankduc, Today, 09:00 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post frankduc  
                              Started by Kabua, Yesterday, 11:24 PM
                              1 response
                              7 views
                              0 likes
                              Last Post koganam
                              by koganam
                               
                              Started by KandI, Today, 08:03 AM
                              2 responses
                              7 views
                              0 likes
                              Last Post KandI
                              by KandI
                               
                              Started by kujista, Yesterday, 10:33 PM
                              5 responses
                              15 views
                              0 likes
                              Last Post NinjaTrader_ChrisL  
                              Started by tonynt, Today, 07:27 AM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_PatrickG  
                              Working...
                              X