NexusFi: Find Your Edge


Home Menu

 





Change chart period


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one shazzmoe with 2 posts (1 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 Jaba with 1 posts (0 thanks)
    4. looks_4 shaisamuel with 1 posts (0 thanks)
    1. trending_up 2,051 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

Change chart period

  #1 (permalink)
 shazzmoe 
Denver Colorado
 
Experience: Advanced
Platform: NinjaTrader
Trading: ES
Posts: 10 since Aug 2012
Thanks Given: 0
Thanks Received: 3

I've seen similar questions that the only solution is to use a send key.

I'm wondering if anyone has figured out a way to have an indicator change the chart's period.

Basically I'm trying to set up and indicator that looks at daily data (secondary time frame) and calculates from that what the primary time frame should be. I get this value just fine but don't know how to change the chart's period without doing a send key. Send key might work if there was a way to guarantee that chart had focus (if there is a way for that i'd appreciate any help).

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Increase in trading performance by 75%
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
Bigger Wins or Fewer Losses?
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
11 thanks
GFIs1 1 DAX trade per day journal
11 thanks
  #3 (permalink)
 Jaba 
Austin TX
 
Experience: Intermediate
Platform: SaintGobain Crystal Ball
Trading: 6E
Posts: 81 since Oct 2010
Thanks Given: 103
Thanks Received: 134


I hope this is what you are looking for:

 
Code
        protected override void OnStartUp()
        {
            this.Bars.Period.Id = PeriodType.Minute;
            this.Bars.Period.Value = 5;
        }
J

Reply With Quote
  #4 (permalink)
 shazzmoe 
Denver Colorado
 
Experience: Advanced
Platform: NinjaTrader
Trading: ES
Posts: 10 since Aug 2012
Thanks Given: 0
Thanks Received: 3

thanks that does seem to adjust the chart settings but doesn't reload the chart.

I ended up doing this and it seems to work the majority of the time.

 
Code
if(BarsArray[0].Period.Value != PeriodSize)
			{
				ChartControl.BarsArray[0].Period.Value = PeriodSize;
				// Make sure chart window is active.
				ChartControl.ParentForm.Activate(); 
				// Ctrl-Shift-R = reload historical data.
				System.Windows.Forms.SendKeys.SendWait("^+R"); 
			}

Started this thread Reply With Quote
Thanked by:
  #5 (permalink)
 shaisamuel 
San Diego, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, NQ, TF, YM, FDAX, ZN, ZB, CL, GC
Posts: 4 since Sep 2013
Thanks Given: 1
Thanks Received: 0

shazzmoe, or anyone... thanks, it worked like a charm in NT7.

Any idea of how this can be done in NT8? I think the basic code is here, but I am missing the special sauce...

 
Code
            	if (State == State.DataLoaded)
			        {	            
					    if(ChartBars != null)
					    {
							if (ChartBars.Properties.BarsPeriod.BarsPeriodType != BarsPeriodType.Minute || 
										ChartBars.Properties.BarsPeriod.Value != 30)
							{
								ChartBars.Properties.BarsPeriod.BarsPeriodType = BarsPeriodType.Minute;
								ChartBars.Properties.BarsPeriod.Value = 30;
                                                                //...
                                                               //special sauce is missing here
                                                               //...
							}
					    }
					break;
			        }

Reply With Quote




Last Updated on September 24, 2018


© 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