• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Per Instrument Indicator and Data Series Settings

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

    Per Instrument Indicator and Data Series Settings

    Using NT 7 I have struggled with the issue of trying to reuse the same charts with different futures contracts that have wildly different price scales. In particular this occurs with the ZigZag indicator and Renko bars. The values that make sense for this indicator and this bar type depend on which instrument is loaded into the chart.

    For example, when looking at NQ which is priced around 4426 and trades in 0.25 point ticks, I have my Renko chart set to 3 tick bricks, and a ZigZag indicator set to 2.5 point swings. When switching the instrument of this chart to CL, which is about 60 and trades in 0.01 point ticks, I want these settings to change to 6 tick Renko and 0.2 point ZigZag.

    The reason I ask is that I like having a set of charts set up for whatever instrument I want to trade at that time, and I want to be able to switch to other instruments when opportunity arises in these other markets.

    Is this possible with NT8? Was this possible in NT7? Is there or will there be a workaround for this, such as custom code that can change the bar and indicator settings when the instrument changes?

    Thanks!

    #2
    This was possible in NinjaTrader 7, although concepts that were not exactly supported but we plan to support in NinjaTrader 8.

    I've attached a modified version of the NinjaTrader 7 ZigZag which will demonstrate how this could be achieved.

    In the OnStartUp() method, we can very easily change the ZigZags DeviationValue based on the instrument fullname; this is nothing fancy and you could do that with any indicator.

    The other thing we do here is check that we check the instrument that the indicator is running on "CL" vs "NQ", based on your examples. Once that has passed, it will then check the BarsPeriod.Id is not Renko, and if the BarsPeriod.Value does not meet your criteria, we create an instance of the NinjaTrader "MiniInstrumentSelector", and pass in the keyboard shortcuts that would change that to your desired chart setting.

    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();
    }
    If you're not familiar, the MiniInstrumentSelector is the little dialog that pops up when you start typing on a chart and is used for changing the instrument or interval of a chart by typing on your keyboard. All we're doing here is passing those keyboard commands programmatically so the switch will happen for you without any user interaction. You can find a list of these short cuts on the following page under the How to change a Data Series section of the help topic

    http://www.ninjatrader.com/support/h...price_data.htm

    This is a very basic example and I only included the two use cases from your post. It does not do any error handling, or prompt for confirmation you would like to request the change-> it just goes ahead and does it. I'm sure you or another programmer could make this much more intelligent, but this should be enough to get you started...
    Attached Files
    Last edited by NinjaTrader_Matthew; 05-14-2015, 02:54 PM.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by NinjaTrader_Matthew View Post
      This was possible in NinjaTrader 7, although concepts that were not exactly supported but we plan to support in NinjaTrader 8.

      I've attached a modified version of the NinjaTrader 7 ZigZag which will demonstrate how this could be achieved.

      In the OnStartUp() method, we can very easily change the ZigZags DeviationValue based on the instrument fullname; this is nothing fancy and you could do that with any indicator.

      The other thing we do here is check that we check the instrument that the indicator is running on "CL" vs "NQ", based on your examples. Once that has passed, it will then check the BarsPeriod.Id is not Renko, and if the BarsPeriod.Value does not meet your criteria, we create an instance of the NinjaTrader "MiniInstrumentSelector", and pass in the keyboard shortcuts that would change that to your desired chart setting.

      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();
      }
      If you're not familiar, the MiniInstrumentSelector is the little dialog that pops up when you start typing on a chart and is used for changing the instrument or interval of a chart by typing on your keyboard. All we're doing here is passing those keyboard commands programmatically so the switch will happen for you without any user interaction. You can find a list of these short cuts on the following page under the How to change a Data Series section of the help topic

      http://www.ninjatrader.com/support/h...price_data.htm

      This is a very basic example and I only included the two use cases from your post. It does not do any error handling, or prompt for confirmation you would like to request the change-> it just goes ahead and does it. I'm sure you or another programmer could make this much more intelligent, but this should be enough to get you started...
      Hm. Should we not ShowDialog() before we SendKey()?

      Comment


        #4
        For whatever reason the send key doesn't get picked up if you show dialog before.. it just sits there waiting for user input. I didn't want to get into any sort of threading concepts and I never bothered to look into it further. I have no idea why it works that way, to be honest!
        MatthewNinjaTrader Product Management

        Comment


          #5
          Thank you very much for the code sample. The code works perfectly for my example, however, I am actually using a custom bar type that is called BetterRenko and I cannot figure out how to get the code to switch the brick size on these custom bars. Is there a key stroke that will work for my Custom4 period type, or perhaps there is another way?

          Comment


            #6
            Unfortunately not possible with custom bar types...

            I will research this and see what has/can be improved for NinjaTrader 8
            MatthewNinjaTrader Product Management

            Comment


              #7
              Originally posted by NinjaTrader_Matthew View Post
              Unfortunately not possible with custom bar types...

              I will research this and see what has/can be improved for NinjaTrader 8
              Any news on this?

              Comment


                #8
                Our development team is reviewing under NTEIGHT-8289. I'll update this thread when I have more info.
                MatthewNinjaTrader Product Management

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by priceisking, Today, 12:51 PM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_PaulH  
                Started by chartish, Today, 10:33 AM
                3 responses
                18 views
                0 likes
                Last Post chartish  
                Started by casabella, Today, 11:51 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_PaulH  
                Started by Johnny, Today, 11:42 AM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_Jermaine  
                Started by habibalex, Today, 09:03 AM
                2 responses
                14 views
                0 likes
                Last Post sledge
                by sledge
                 
                Working...
                X