Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Change Chart Period Value Programmatically

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Change Chart Period Value Programmatically

    Hi,

    Is it possible to change a chart's Period Value programmatically?

    Regards

    #2
    Hello maltese,

    Thank you for your post.

    This is possible but not supported. Here is an example using the mini Data Series window.
    Code:
    // check that the bars are Renko and that they are not at the desired 6 value
    if(BarsPeriod.Id == PeriodType.Renko && BarsPeriod.Value != 6)
    {
    // if so, invoke the ninjatrader mini instrument selector which will change the period to the 6RE (6 Renko)
    MiniInstrumentSelector MIS = new MiniInstrumentSelector(ChartControl, "6RE");
    System.Windows.Forms.SendKeys.Send("{ENTER}");
    MIS.ShowDialog();
    }

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello maltese,

      Thank you for your post.

      This is possible but not supported. Here is an example using the mini Data Series window.
      Code:
      // check that the bars are Renko and that they are not at the desired 6 value
      if(BarsPeriod.Id == PeriodType.Renko && BarsPeriod.Value != 6)
      {
      // if so, invoke the ninjatrader mini instrument selector which will change the period to the 6RE (6 Renko)
      MiniInstrumentSelector MIS = new MiniInstrumentSelector(ChartControl, "6RE");
      System.Windows.Forms.SendKeys.Send("{ENTER}");
      MIS.ShowDialog();
      }
      Thank you for pointing me in the right direction. Would you know the constructor string for a 500 volume chart?

      Comment


        #4
        Yes, it would be "500V". You can find these listed at the following link under 'How to change a Data Series': http://ninjatrader.com/support/helpG...price_data.htm

        Comment


          #5
          Originally posted by NinjaTrader_PatrickH View Post
          Yes, it would be "500V". You can find these listed at the following link under 'How to change a Data Series': http://ninjatrader.com/support/helpG...price_data.htm
          Thank you, thank you, thank you. Have a nice weekend

          Comment


            #6
            Hello,

            How could I set the "Chart Period Value" with code in Ninjatrader 8?

            For ex: Change the chart time from 5 Minute to 15 Minute without a human mouse click or keyboard action.

            Thank you!
            Last edited by ninjo; 07-01-2019, 04:25 AM.

            Comment


              #7
              Hello ninjo,

              This concept would again be something which is not documented/supported in NT8. I would suggest searching the forum for other members who have tried to accomplish this and the routes they took. This is not something I would have a specific sample for, but is something which has been tried in the past. One search which brings up some results is " nt8 send keys".



              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                Hi Jesse,

                I dont have problem with c# sendkeys. I need the function or method for set the "Chart Period Value" of the NT8 chart window via code.
                Could you tell me a reference for it?
                Thank you!

                Comment


                  #9
                  Hello ninjo,

                  This is not something which is documented, so I would not have anything additional that I could provide here. You would need to use key commands for the options you wanted if available. There is currently no specific NinjaScript way to interface with the instrument selector or interval selector.



                  To change an interval:

                  Type interval value plus the interval suffix (Value +suffix). Examples: "5M" for 5 minute bars, "100T" for 100 tick bars, "1D" for 1 Day bars,10 etc.
                  NT8 also uses a different window framework now so often the focus of the control in questions becomes a problem, it is not accurate to try and send commands to a control in this way. Assuming the

                  I look forward to being of further assistance.



                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    Hi

                    I am trying this code and nothing happend:

                    System.Windows.Forms.SendKeys.SendWait("180M");
                    System.Windows.Forms.SendKeys.SendWait("{ENTER}");

                    If only try SendWait("180M"); then its works but the black overlay screen does not disappear...

                    Could you tell me how could I "Enter" the data of the chart time with code? Thanks
                    Last edited by ninjo; 07-16-2020, 12:36 PM.

                    Comment


                      #11
                      I attach my basic example .cs as an indicator.

                      Test and then uncomment the next line and test again.

                      System.Windows.Forms.SendKeys.SendWait("{ENTER}");


                      Attached Files
                      Last edited by ninjo; 07-17-2020, 05:10 AM.

                      Comment


                        #12
                        Hello ninjo,

                        The SendKeys command is used for Windows Forms programs, this does not work correctly in WPF due to the focus in the windows and controls. This is what my comment in post #9 was about:
                        NT8 also uses a different window framework now so often the focus of the control in questions becomes a problem, it is not accurate to try and send commands to a control in this way.
                        You can see the Rollover Indications indicator that is on the public user app share for an example of managing focus and invoking key commands on a target control, that would be the only way that is known to work in NT8. https://ninjatraderecosystem.com/use...earch=rollover


                        Please let me know if I may be of further assistance.
                        JesseNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by kaywai, 09-01-2023, 08:44 PM
                        5 responses
                        601 views
                        0 likes
                        Last Post NinjaTrader_Jason  
                        Started by xiinteractive, 04-09-2024, 08:08 AM
                        6 responses
                        22 views
                        0 likes
                        Last Post xiinteractive  
                        Started by Pattontje, Yesterday, 02:10 PM
                        2 responses
                        16 views
                        0 likes
                        Last Post Pattontje  
                        Started by flybuzz, 04-21-2024, 04:07 PM
                        17 responses
                        230 views
                        0 likes
                        Last Post TradingLoss  
                        Started by agclub, 04-21-2024, 08:57 PM
                        3 responses
                        17 views
                        0 likes
                        Last Post TradingLoss  
                        Working...
                        X