Centering chart on the Y axis - NinjaTrader Programming | futures io social day trading
futures io futures trading


Centering chart on the Y axis
Updated: Views / Replies:5,221 / 12
Created: by Adamus Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Centering chart on the Y axis

  #11 (permalink)
Elite Member
Houston,Tx
 
Trading Experience: Advanced
Platform: NinjaTrader
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: TF
 
ThatManFromTexas's Avatar
 
Posts: 2,302 since Feb 2010
Thanks: 1,208 given, 4,328 received


sniffy View Post
this works for me

#region Event Handlers
private void centrePrice_Click(object sender, EventArgs e)
{
this.ChartControl.YAxisRangeTypeRight = YAxisRangeType.Fixed;
double yAxisSize = this.ChartControl.FixedPanelMaxRight -
this.ChartControl.FixedPanelMinRight;
this.ChartControl.FixedPanelMaxRight = Close[0] + (yAxisSize / 2);
this.ChartControl.FixedPanelMinRight = Close[0] - (yAxisSize / 2);

// force repaint so we dont have to wait for another event
ChartControl.ChartPanel.Invalidate(); // <<<<<<--------------------

}
#endregion Event Handlers

@sniffy

Please bear with me... I am self taught in writing code for Ninja Trader.... and my teacher isn't very good...

I'm trying to understand the code. Is this the entire thing or just a snippet?

Thanks....

I'm just a simple man trading a simple plan.

My daddy always said, "Every day above ground is a good day!"
Reply With Quote
 
  #12 (permalink)
Trading Apprentice
alask
 
Trading Experience: Master
Platform: ninja
 
Posts: 7 since Oct 2009
Thanks: 0 given, 5 received

follow adamus code

Adamus posted pretty much the entire thing above.

He is adding toggleTrade and centrePrice buttons to the ChartTrader panel.

His centreprice event handler will be fired when he clicks his centreprice button.

After the image coordinates are reset he needs to ensure that the image is repainted.

Moving the mouse off the region and back again has the effect of forcing a repaint, so that is
why he sees the behaviour that he sees,

To avoid dependence on other random repaint events he simply needs to force a repaint to happen by
using the Control. Invalidate() method.

This forces the repaint so that he can see the effect of his coordinates change.

So simply add ChartControl.ChartPanel.Invalidate(); to the event handler after changing the coordinates.

There is plenty of discussion about using .Invalidate method on the various forums, MSDN etc.

hope this helps


Last edited by sniffy; March 23rd, 2012 at 03:16 AM.
Reply With Quote
The following 2 users say Thank You to sniffy for this post:
 
  #13 (permalink)
Elite Member
London, UK
 
Trading Experience: Beginner
Platform: NinjaTrader, home-grown Java
Broker/Data: IB/IQFeed
Favorite Futures: EUR/USD
 
Adamus's Avatar
 
Posts: 1,085 since Dec 2010
Thanks: 471 given, 782 received

Uploaded the Chart Trader indicator with extra functionality that I use


Here's the zip:

https://futures.io/download/ninjatrader-7/indicators/1174-download.html?view

You can discover what your enemy fears most by observing the means he uses to frighten you.
Reply With Quote
The following 3 users say Thank You to Adamus for this post:

Reply



futures io > > > > > Centering chart on the Y axis

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

Pro Trader vs Pro Athlete w/Brannigan Barrett @ Habitus Capital

Elite only
 

60 Minutes to Better Decisions & Better Trades w/Agustin Lebron

Elite only
 

Live Day Trading the E-MICROS w/Ilan @ Cannon (special time: 12PM ET)

May 30
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change the time axis (x axis) on Sierra Charts Affliction Sierra Chart 2 September 27th, 2011 12:27 PM
InvestorRT axis label coloring Big Mike Investor/RT 3 August 18th, 2011 06:53 AM
MATLAB Dates on the x - axis jakfourie Matlab, R project and Python 11 June 27th, 2011 02:55 AM
Formatting the Y-Axis Fat Tails NinjaTrader Programming 12 January 26th, 2011 05:32 AM
plot reference axis SARdynamite NinjaTrader Programming 1 July 8th, 2010 07:50 AM


Tags
chart trader, chartcontrol, charttrader, code, data, dom, dow, el, elite, es, futures, indicator, indicators, information, market analyzer, namespace, ninja, ninja trader, ninjascript, ninjatrader, programming, repainting, search, strategies, support, tick

All times are GMT -4. The time now is 12:51 PM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business, info@futures.io
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.
no new posts
Page generated 2019-05-22 in 0.19 seconds with 14 queries on phoenix