NexusFi: Find Your Edge


Home Menu

 





Code to save my chart in a directory


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one cunparis with 4 posts (0 thanks)
    2. looks_two TAJTrades with 4 posts (0 thanks)
    3. looks_3 dario1 with 1 posts (0 thanks)
    4. looks_4 Gary with 1 posts (0 thanks)
    1. trending_up 3,317 views
    2. thumb_up 0 thanks given
    3. group 5 followers
    1. forum 9 posts
    2. attach_file 1 attachments




 
Search this Thread

Code to save my chart in a directory

  #1 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,093

I trade from work and during my commute using my iPhone. Don't laugh, Darvas traded with telegrams! I find that I actually do very well if I'm not watching the market. I have my charts emailed to me whenever a trigger occurs (new swing hi/low for example).

I'd like to have my indicator save my image as a jpeg to a specific directory on my pc, I have tomcat running to serve it up over HTTP. Then I can check my chart real time any time I want without waiting for a trigger to send an email.

Any ideas on how to do this? I'm using this to email the chart, I got it from a forum, I don't know .NET:

 
Code
                // get bitmap of chart panel
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(chart.ChartPanel.Width, chart.ChartPanel.Height, PixelFormat.Format16bppRgb555);
                chart.ChartPanel.DrawToBitmap(bmp, chart.ChartPanel.ClientRectangle);
                
                // save to stream (as jpg to reduce size)
                System.IO.MemoryStream stream = new System.IO.MemoryStream();
                bmp.Save(stream, ImageFormat.Jpeg );
                stream.Position = 0;
I can post my email indicator if anyone is interested.

Follow me on Twitter Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
Deepmoney LLM
Elite Quantitative GenAI/LLM
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
NexusFi Journal Challenge - April 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
Battlestations: Show us your trading desks!
26 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
The Program
17 thanks
  #2 (permalink)
TAJTrades
Here, GA
 
Posts: 158 since Jun 2009
Thanks Given: 1
Thanks Received: 86

Cunparis, yes it can be done. I had an auto screen saver working that would periodically capture all my trading screens. I stop using it because it was capturing too many forums in lull periods. LOL. I will try to dig it out for you after the close.

Reply With Quote
  #3 (permalink)
 
Gary's Avatar
 Gary 
Near Dallas, Texas, US
 
Experience: Advanced
Platform: NinjaTrader
Broker: ZenFire
Trading: CL
Posts: 1,072 since Jun 2009
Thanks Given: 502
Thanks Received: 2,239


Have you looked at something like this?

It's Here! Remote Desktop Client (RDP) for the IPhone and iPod Touch - Terminal Services / Citrix Client

Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,093



I use Jaadu remote desktop for iPhone. It works great. Well almost. There is no way to middle click so I use AutoHotKey. There is no way to scroll the DOM either. I haven't got a solution for that one.

But I can't leave remote desktop connected all the time. I just want something where I can refresh a webpage and see my chart. Just one.

TAJTrades - I want to save just the chart and not all the desktop because I need the file to be very small so I don't use up my bandwidth limit on the iPhone.

Follow me on Twitter Started this thread Reply With Quote
  #5 (permalink)
TAJTrades
Here, GA
 
Posts: 158 since Jun 2009
Thanks Given: 1
Thanks Received: 86


cunparis View Post
TAJTrades - I want to save just the chart and not all the desktop because I need the file to be very small so I don't use up my bandwidth limit on the iPhone.


Does anyone know the code to bring "Focus" to a specific chart within an NT Indicator. Say I want to make the 5 Min chart the active chart and then get the get the location of the Form on the screen? That would solve an issue for cunparis and myself.

Reply With Quote
  #6 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,093


TAJTrades View Post
Does anyone know the code to bring "Focus" to a specific chart within an NT Indicator. Say I want to make the 5 Min chart the active chart and then get the get the location of the Form on the screen? That would solve an issue for cunparis and myself.

I think you're looking at it from another perspective.

I add an indicator to my chart which emails me the chart when a trigger occurs. So there is no focus. The only catch is the chart cannot be minimized but that's not a problem for me.

I'm going to fool around with .NET and find a way to save the bitmap to a PNG file, will try it this weekend.

Follow me on Twitter Started this thread Reply With Quote
  #7 (permalink)
TAJTrades
Here, GA
 
Posts: 158 since Jun 2009
Thanks Given: 1
Thanks Received: 86


cunparis View Post
I'm going to fool around with .NET and find a way to save the bitmap to a PNG file, will try it this weekend.


What I have working uses the following:

Screen[] screens = Screen.AllScreens;
switch (whichScreen)
{
case "One":
bounds = screens[0].Bounds;
break;
case "Two":
bounds = screens[1].Bounds;
break;
case "All":
bounds = Rectangle.Union(screens[0].Bounds, screens[1].Bounds);
break;
default:
bounds = Rectangle.Union(screens[0].Bounds, screens[1].Bounds);
break;
}

Screen[] If you have a multiple screen setup you must specify which or all screens to capture the image as will as the the BitsPerPixel.


using (Bitmap captured = new Bitmap(bounds.Width, bounds.Height, format))
using (Graphics gdi = Graphics.FromImage(captured))


Bounds will tell the indicator to draw a rectangle and then you capture that area to create the image. Once you have captured the image then you can draw on the image any additional information you would like.

So if you have a Static screen (never changes from day to day) then you can avoid bringing Focus to a specific Form and just capture the same rectangle. The rectangle can be any size you want to specify. If you are concerned about band width then you may choose to capture just a small part of the screen.


captured.Save(publicFileName, ImageFormat.Png);

This would be an example of how you specify the file format.


What I have done is capture all the screens individually. Then manipulate the individual images and stack them vs having them side by side as is the Windows setup. I also replace the DOM with a blank rectangle and use that area to add additional notes to the image. It is very specific to what I wanted to accomplish and only works on the computer that it was written for. All this is done based upon the bar count for the fastest time frame therefor I capture every bar on every chart.

The advantage of bringing Focus to each Form before capturing would be that you would not be capturing this Big Mikes Trading website when the indicator fired the command to capture.


Forgot to add: If someone has already figured out how move from Form to Form and then do a check for the Period and Interval thereby knowing which Form to bring Focus to then it would be easy for me to convert my stuff for you. By doing this I can code an indicator that says: 1) Entry signal issued, 2) Capture the 5 Minute Chart, 3) save the chart. Then all that is left is mailing the Attachment.

Reply With Quote
  #8 (permalink)
TAJTrades
Here, GA
 
Posts: 158 since Jun 2009
Thanks Given: 1
Thanks Received: 86

Here is a sample picked at random of my automated screen capture. It is the 3rd image captured on July 13, 2009. On the very bottom right corner you will see where I added the File Name to the Image on Top of the Slider Bar. The White rectangle is where I remove the DOM from the image.

Attached Thumbnails
Click image for larger version

Name:	Public ES 090713 Mon Day 3.png
Views:	179
Size:	290.9 KB
ID:	2676  
Reply With Quote
  #9 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,093


TAJTrades View Post
Here is a sample picked at random of my automated screen capture. It is the 3rd image captured on July 13, 2009. On the very bottom right corner you will see where I added the File Name to the Image on Top of the Slider Bar. The White rectangle is where I remove the DOM from the image.

'What I want to do is even easier. I have one small chart. That's all I want. I'm viewing these on an iphone so it has to be as small as possible. and as fast as possible.

Follow me on Twitter Started this thread Reply With Quote
  #10 (permalink)
 
dario1's Avatar
 dario1 
Ontario, Canada
 
Experience: None
Platform: NT
Broker: IB
Trading: gold
Posts: 404 since Jan 2012


Anyone has a program to save a NT chart every 30 min. The chart is inside my NT workspace but is not an active chart on my PC screen.
Thank you

Reply With Quote




Last Updated on August 14, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts