NexusFi: Find Your Edge


Home Menu

 





Access Chart Color property?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one vantojo with 4 posts (1 thanks)
    2. looks_two gregid with 4 posts (3 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 jupikseliga with 1 posts (0 thanks)
    1. trending_up 2,511 views
    2. thumb_up 4 thanks given
    3. group 3 followers
    1. forum 9 posts
    2. attach_file 3 attachments




 
Search this Thread

Access Chart Color property?

  #1 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

I would like to set the chart background color in code....

For example, when I want to print or save the chart, I want the background to be White. Otherwise, I use a darker color, which does not print well, to ease the brightness of the chart on my eyes.

Now I have to go through multiple steps, right mouse click, pop up box....et cetera

If I can access the Chart property directly and change the color with code then I can just make a button.

Actually when I think about it...wouldn't it be great to have a button for Print, and a button for Save, that would do the whole thing with one click...change the chart background to white, print/save, and then revert the chart back to the original color...better yet, to do this in the background.

any ideas guys?

(it would be better even yet, if Ninja would provide this feature...when Printing or Saving to have a default color for background)

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trend Direction Force Index (TDFI)
Platforms and Indicators
ZombieSqueeze
Platforms and Indicators
About a successful futures trader who didnt know anythin …
Psychology and Money Management
Cheap historycal L1 data for stocks
Stocks and ETFs
Trade idea based off three indicators.
Traders Hideout
 
  #3 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623


@vantojo

It is actually quite straight forward - to get current chart background, change it, then revert to original use:

 
Code
Color originalColor = ChartControl.BackColor;

// change color to green:
ChartControl.BackColor = Color.Green;

// revert back to original color:
ChartControl.BackColor = originalColor;

Reply With Quote
  #4 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623

As to your other requests, look into following threads and solution for enhanced Print/Save functionality:
@ratfink's journaling tool:

@vvhg's screenshot utility and some other tools by him:


Reply With Quote
Thanked by:
  #5 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Way cool, thank you!!

Started this thread Reply With Quote
  #6 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

private void ColorButton_Click(object sender, EventArgs e)
{
Color MyGreen = Color.FromArgb (0,192,0);

if (ChartControl.BackColor == MyGreen)
ChartControl.BackColor = Color.Yellow;
else
if (ChartControl.BackColor == Color.Yellow)
ChartControl.BackColor = Color.White;
else
if (ChartControl.BackColor == Color.White)
ChartControl.BackColor = MyGreen;
}

Started this thread Reply With Quote
  #7 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623

You could also add a dropdown field that would change the "theme" on selection.

BTW, once you are done with the indicator, if you can, post it here so others (less programmatically inclined can benefit.

Reply With Quote
  #8 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Ok, sample TEST code attached. This will put a button on ChartTrader that allows clicks to toggle through a hard coded group of colors....see ColorButton_Click(...) to add or delete colors.

I don't like using drop downs because they require multiple mouse movements...for me they are too complicated when I want to keep my focus on the charts.

So, I prefer to click through the short list rather than do the drop down.

A single click advances through the list.

The list could be in an array or other structure.

For it to work, the initial chart color must be one in the list.

Attached Files
Elite Membership required to download: BMTColorButton.cs
Started this thread Reply With Quote
  #9 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623

@vantojo,
As a reward for sharing with the community here is updated version which doesn't hard code Colors, instead it lets you select new colors from the collection editor.

For those trying it out - the button is located on the Chart Trader.

Attached Files
Elite Membership required to download: BMTColorButton.zip
Reply With Quote
Thanked by:
  #10 (permalink)
 
jupikseliga's Avatar
 jupikseliga 
Europe-Ireland
 
Experience: Intermediate
Platform: NT8
Broker: NT
Trading: ES, NQ, CL
Posts: 175 since Feb 2012
Thanks Given: 114
Thanks Received: 92



gregid View Post
@vantojo,
As a reward for sharing with the community here is updated version which doesn't hard code Colors, instead it lets you select new colors from the collection editor.

For those trying it out - the button is located on the Chart Trader.

Its Perfect !! Thank you for this# !!! @gregid

Would u think, that you can add chart button for change background color exactly like in vvScreenShot ?

Hard work make me rich
Attached Thumbnails
Click image for larger version

Name:	vv.jpg
Views:	199
Size:	268.9 KB
ID:	190210  
Reply With Quote




Last Updated on August 17, 2015


© 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