NexusFi: Find Your Edge


Home Menu

 





Explanation somewhere on creating custom plots with colors etc......


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one forrestang with 7 posts (0 thanks)
    2. looks_two devdas with 3 posts (6 thanks)
    3. looks_3 cory with 2 posts (2 thanks)
    4. looks_4 futuretrader with 1 posts (1 thanks)
    1. trending_up 6,665 views
    2. thumb_up 9 thanks given
    3. group 2 followers
    1. forum 13 posts
    2. attach_file 6 attachments




 
Search this Thread

Explanation somewhere on creating custom plots with colors etc......

  #11 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047


forrestang View Post
I've made some headway with using:

 
Code
public override void Plot()
Is it possible to pass variables into this function from my main program?

The answer is YES! Although indirectly.

The variables created in main function declared globally are available to that function.

Also, if you have this in a separate study as I do, .... you can first capture into the main body of script any variables from OTHER studies, and then those variables are available to the void plot() function.

Woot!

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
Increase in trading performance by 75%
The Elite Circle
Exit Strategy
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
My NQ Trading Journal
12 thanks
  #12 (permalink)
 
devdas's Avatar
 devdas 
Al,India
 
Experience: Advanced
Platform: NinjaTrader
Broker: Z
Trading: NiftyFuture
Posts: 1,562 since Feb 2010
Thanks Given: 1,513
Thanks Received: 1,701


forrestang View Post
The answer is YES! Although indirectly.

The variables created in main function declared globally are available to that function.

Also, if you have this in a separate study as I do, .... you can first capture into the main body of script any variables from OTHER studies, and then those variables are available to the void plot() function.

Woot!

glad...ur getting interest.
about aligning text in graphics in different lines...there are string formats and you can get the hieght of text to be displayed to offset next line.

yes can have globals to transport values...but recently i stuck with graphics plot.....could not retain values
outside the Plot scope as opposite to other methods. It was very frustrating excercise to get values derived
inside graphics plot to outside. Hope some more experienced coder help me out.


 
Code
 
public override void Plot(Graphics graphics,Rectangle bounds,double min,double max)
{
 
mymin = min;                    // mymin Global variable.
Print(mymin.ToString());   // works only if remains as long as in Plot. Losses value
}                                      // outside the plot.


Harvest The Moon
Nest The Market
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #13 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047


@devdas

If you wanted to add the textbrush as a user input so that you could change the colors, how do you go about doing that?

Started this thread Reply With Quote
  #14 (permalink)
 
devdas's Avatar
 devdas 
Al,India
 
Experience: Advanced
Platform: NinjaTrader
Broker: Z
Trading: NiftyFuture
Posts: 1,562 since Feb 2010
Thanks Given: 1,513
Thanks Received: 1,701


forrestang View Post
@ devdas

If you wanted to add the textbrush as a user input so that you could change the colors, how do you go about doing that?


this is simple and similar to other variables. Look following changes should be made in script.

1) Declare your text brush without initialisation and add another variable for color.

 
Code
 
#region Variables
.........................
private  System.Drawing.Brush   textbrush;    // no initialization of Brush
private  Color   textcolor;                                 // variable for color.
..........................
#endregion
2) Initialize TextBrush where u need and dispose after use.

 
Code
 
public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
{
............................
textbrush = new SolidBrush(textcolor);        // initialize here
.......................
.......................
.......................
textbrush.Dispose();                                    // dispose after use.
 }

3) Make provision for this in Properties...so that it could be shown for input.( Important)

 
Code
 
#region Properties
[Description("Select Text Color")]
[Category("Colors")]
[Gui.Design.DisplayName("Text Color")]
public Color Textcolor
{
get { return textcolor; }
set { textcolor = value; }
}
#endregion
and you are done...

Harvest The Moon
Nest The Market
Attached Thumbnails
Click image for larger version

Name:	ColorSelection.png
Views:	219
Size:	33.0 KB
ID:	48902  
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on September 9, 2011


© 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