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:4,252 / 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 90,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
 
Futures 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,293 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
 
Futures 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 04:16 AM.
Reply With Quote
The following 2 users say Thank You to sniffy for this post:
 
  #13 (permalink)
Elite Member
London, UK
 
Futures 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: 470 given, 778 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)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

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 01:27 PM
InvestorRT axis label coloring Big Mike Investor/RT 3 August 18th, 2011 07:53 AM
MATLAB Dates on the x - axis jakfourie Matlab, R project and Python 11 June 27th, 2011 03:55 AM
Formatting the Y-Axis Fat Tails NinjaTrader Programming 12 January 26th, 2011 06:32 AM
plot reference axis SARdynamite NinjaTrader Programming 1 July 8th, 2010 08:50 AM


All times are GMT -4. The time now is 08:35 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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 2017-12-15 in 0.10 seconds with 19 queries on phoenix via your IP 54.234.247.118