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 Quick Summary with 1 posts (0 thanks)
    1. trending_up 6,608 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......

  #1 (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

You guys know that function sometimes used near the bottom of scripts, under properties for creating graphics on a chart..... Usually starts like this:
 
Code
public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
Ninja says they don't support this, so they probably don't have a write up on it anywhere. I guess its about time I figure that out.

But do you guys know of an explanation somewhere on how to create that block, and how it works?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Are there any eval firms that allow you to sink to your …
Traders Hideout
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Deepmoney LLM
Elite Quantitative GenAI/LLM
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
GFIs1 1 DAX trade per day journal
22 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
The Program
20 thanks
  #3 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


some primers

Reply With Quote
Thanked by:
  #4 (permalink)
 futuretrader 
Como Italy
 
Experience: Intermediate
Platform: Ninjatrader, customized
Trading: ES
Posts: 525 since Feb 2010
Thanks Given: 471
Thanks Received: 643

NT doesn't support it, but somewhere on the site they have an example of custom plotting posted. (I don't have it any more, but it's probably called something like "SampleCustomPlotMethod"). Otherwise, your best bet is just to look at some of the indicators others have uploaded.

Reply With Quote
Thanked by:
  #5 (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

It provides a context to draw custom drawings through a Graphics object that "tied to" or "points to" the panel on which indicator will be applied. However its uses are certainely wide...but you can start doing simple experiments with drawing some lines and other shapes with function avalibale with graphics object. Just type
"graphics." and intellisence will show available methods for use.

similarly bounds will occupy the rectangular space of panel in which indicator will be applied...and hence mostly represent dimensions in screen pixels....just type "bounds." and get availble methods.

Lastly min and max represnt the minimum and maximum values of vertical scale of indicator panel in which indicator is applied. If none of plot containing dataseries exisit in indicator then these min and max will be nearly 0 and 1.

For your example i hv created a small script, it only draws a rectangle and then draws a string in that
showing scales minimum and maximum values. Just put indicator one by one in price panel and seperate panel and see how it behaves on scrolling chart/changing scale etc.

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

Name:	MyExp.png
Views:	293
Size:	57.1 KB
ID:	48304  
Attached Files
Elite Membership required to download: MyExp3.cs
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #6 (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 View Post
It provides a context to draw custom drawings through a Graphics object that "tied to" or "points to" the panel on which indicator will be applied. However its uses are certainely wide...but you can start doing simple experiments with drawing some lines and other shapes with function avalibale with graphics object. Just type
"graphics." and intellisence will show available methods for use.

similarly bounds will occupy the rectangular space of panel in which indicator will be applied...and hence mostly represent dimensions in screen pixels....just type "bounds." and get availble methods.

Lastly min and max represnt the minimum and maximum values of vertical scale of indicator panel in which indicator is applied. If none of plot containing dataseries exisit in indicator then these min and max will be nearly 0 and 1.

For your example i hv created a small script, it only draws a rectangle and then draws a string in that
showing scales minimum and maximum values. Just put indicator one by one in price panel and seperate panel and see how it behaves on scrolling chart/changing scale etc.

Looking more at your example today. Really good example.

Although the intellisense you mentioned doesn't seem to work.

Started this thread Reply With Quote
  #7 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090

as far as text colors check out indi from TMFT
View Download Details - Big Mike's Trading Forum

Reply With Quote
  #8 (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

In your example, you use:
 
Code
graphics.DrawString("Scale Min: " + smin + "  Scale Max: " + smax,textfont,textbrush,new Point(recleft + 10,rectop + 5));
Now it looks like this prints a string a fixed distance from the left of your rectangle, and a fixed distance from the top of your rectangle.

What if I wanted to be able to plot several variables one next to and under each other, while being able to keep everything in a nice tight box? Is this possible?

Liek in the picture I have attached here?

Attached Images
 
Started this thread Reply With Quote
  #9 (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
@devdas

In your example, you use:
 
Code
graphics.DrawString("Scale Min: " + smin + "  Scale Max: " + smax,textfont,textbrush,new Point(recleft + 10,rectop + 5));
Now it looks like this prints a string a fixed distance from the left of your rectangle, and a fixed distance from the top of your rectangle.

What if I wanted to be able to plot several variables one next to and under each other, while being able to keep everything in a nice tight box? Is this possible?

Liek in the picture I have attached here?

Sorta thinking out loud here. But with that picture in the post I have above....... Basically I am wanting to create a text box that will remain organized if the chart is resized or if the bars are expanded or contracted.

In the script example @devdas posted, I was moving that box and text around as he suggested. And I see that he had it lined up with an offset to the left/top borders.

In that pic above, basically I have a text box, with essentially 3 rows at top with one 3 variables in each row. Followed by 4 more rows, each row with one variable. Maybe what I need to do is align everything into each one of these boxes? Since it seems like the offset is and the way you align things is based on the number of pixels. If I could count the number of pixels of a given string, then I could align everything up properly, solving the scaling problem.


Here is a pic of what I mean.


----EDIT-----------
I see scaling isn't really an issue with this method of drawing. Nice! Let me see what I can come up with.

Attached Thumbnails
Click image for larger version

Name:	9-7-2011 5-59-39 PM.png
Views:	188
Size:	4.1 KB
ID:	48682  
Started this thread Reply With Quote
  #10 (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


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?

Attached Thumbnails
Click image for larger version

Name:	Prime2011-09-07_195444.jpg
Views:	215
Size:	101.5 KB
ID:	48693  
Started this thread Reply With Quote




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