NexusFi: Find Your Edge


Home Menu

 





Learning Chart Control Programming


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one zeller4 with 3 posts (0 thanks)
    2. looks_two dutchbookmaker with 2 posts (3 thanks)
    3. looks_3 monpere with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 5,584 views
    2. thumb_up 3 thanks given
    3. group 4 followers
    1. forum 7 posts
    2. attach_file 3 attachments




 
Search this Thread

Learning Chart Control Programming

  #1 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404

Hello All,

I'm attaching one new indicator I'm attempting to use with Chart Control. If you scroll back through the chart, you'll see the colors change with what I'm assuming is the current screen's right edge data.

Unfortunately, it's not performing like I expect for some of the current info from the other bararrays.

This is based on the SMAFromRangeBars. I changed SMA to EMA and RangeBars to minute bars and added another BarsInProgress array.

I'd appreciate if anyone could help me modify this to provide correct data to the graphic colors. I've seen some instances where the color of the dot should be red but it's green or should be green but it's red. Any other simple examples with chart control would be highly appreciated.

On a future version, I'll be adding labels to the graphic.

Best Regards,

Kirk

Attached Thumbnails
Click image for larger version

Name:	6E 06-11 (1 Min)  4_19_2011.jpg
Views:	423
Size:	86.5 KB
ID:	36948  
Attached Files
Elite Membership required to download: EMAs_1_3_9_v01.zip
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Exit Strategy
NinjaTrader
Futures True Range Report
The Elite Circle
Are there any eval firms that allow you to sink to your …
Traders Hideout
 
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
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #3 (permalink)
 
redratsal's Avatar
 redratsal 
Milan (I)
 
Experience: Advanced
Platform: Ninjatrader
Broker: Kinetick
Trading: FDAX,6E,CL,YM,NQ,ES
Posts: 1,648 since Oct 2010
Thanks Given: 1,215
Thanks Received: 2,090



zeller4 View Post
Hello All,

I'm attaching one new indicator I'm attempting to use with Chart Control. If you scroll back through the chart, you'll see the colors change with what I'm assuming is the current screen's right edge data.

Unfortunately, it's not performing like I expect for some of the current info from the other bararrays.

This is based on the SMAFromRangeBars. I changed SMA to EMA and RangeBars to minute bars and added another BarsInProgress array.

I'd appreciate if anyone could help me modify this to provide correct data to the graphic colors. I've seen some instances where the color of the dot should be red but it's green or should be green but it's red. Any other simple examples with chart control would be highly appreciated.

On a future version, I'll be adding labels to the graphic.

Best Regards,

Kirk

Hello Kirk,

Have you checked this thread , you might find what you were looking for in the cursor state script.

Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404

thanks redratsal,

I'm sure there's a few things to learn from that code so I'll be delving into it deeper. It's not exactly what I'm looking for at the moment but I appreciate it.

kz

Started this thread Reply With Quote
  #5 (permalink)
 
monpere's Avatar
 monpere 
Bala, PA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus, IB
Trading: SPY, Oil, Euro
Posts: 1,854 since Jul 2010
Thanks Given: 300
Thanks Received: 3,371


zeller4 View Post
Hello All,

I'm attaching one new indicator I'm attempting to use with Chart Control. If you scroll back through the chart, you'll see the colors change with what I'm assuming is the current screen's right edge data.

Unfortunately, it's not performing like I expect for some of the current info from the other bararrays.

This is based on the SMAFromRangeBars. I changed SMA to EMA and RangeBars to minute bars and added another BarsInProgress array.

I'd appreciate if anyone could help me modify this to provide correct data to the graphic colors. I've seen some instances where the color of the dot should be red but it's green or should be green but it's red. Any other simple examples with chart control would be highly appreciated.

On a future version, I'll be adding labels to the graphic.

Best Regards,

Kirk

Can you explain what is the indicator is suppose to do? Maybe some people can give you some ideas on how to approach it.

Reply With Quote
  #6 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404

Hey monpere,

Good point.

I forgot to mention, I found a TRO SM (Slot Machine) Compass indicator that was ported to NT by cvax that I've used as the basis for the Chart Control portion of the code (chart attached). Just changed colors, types and pixel locations of the graphics.

I'm trying to combine mutiple timeframe information to one chart (the fastest). For this first test I'm using minute bars.

The top three dots are supposed to give the crossover or condition of an EMA13 vs EMA21. Green for above and Red for below. The top is for 9 minute chart, second is 3 minute chart, and third is 1 minute chart. If they all agree, the fourth dot color will be the same color, otherwise it's gold.

The upper right arrows shows relation of an HMA7 vs an EMA7 on the one minute chart. The bottom arrow shows direction of the HMA7 on a one min chart.

I've seen sometimes the dots seem to be the wrong color almost as if it's a repainting type of issue. Or maybe I've just got a bug that hasn't been found yet.

I normally put the colored line plots to transparent so there's not too much data on the chart.

It will plot on a range chart so I'll be testing the other bar arrays as higher range settings.

Mainly, I'm looking for any help with any ChartControl syntax that could improve this code. I saw Shodson put up some sample syntax for Chart Control so I'll be going through that.

kz

Attached Thumbnails
Click image for larger version

Name:	6E 06-11 (1 Min)  4_20_2011.jpg
Views:	319
Size:	63.8 KB
ID:	37034  
Started this thread Reply With Quote
  #7 (permalink)
 dutchbookmaker 
NYC
 
Posts: 187 since Dec 2010

Hah, you hack like me with a million lines commented out.
Thanks for this, I'm starting to try to learn chart control and it is such a pain.

This thread has some good stuff in it if you haven't seen it
How do you convert Price to Y axis values? - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum

Reply With Quote
  #8 (permalink)
 dutchbookmaker 
NYC
 
Posts: 187 since Dec 2010

This drove me mad the last time I tried to get into Ninja..glad to see it makes more sense now in 7. I'm not sure this will help but I spent so long trying to figure out those getX/Y functions, maybe someone else will see this in the future.

int barPaintWidth = base.ChartControl.ChartStyle.GetBarPaintWidth(base.ChartControl.BarWidth);

int lastX = ChartControl.GetXByBarIdx(BarsArray[0], CurrentBar);
int lastY = ChartControl.GetYByValue(this,Close[0]);

graphics.DrawRectangle(new Pen(Color.Black), lastX,lastY, barPaintWidth, barPaintWidth);

Reply With Quote




Last Updated on May 8, 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