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



    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



      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 usazencort, Today, 01:16 AM
                0 responses
                1 view
                0 likes
                Last Post usazencort  
                Started by kaywai, 09-01-2023, 08:44 PM
                5 responses
                603 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
                20 views
                0 likes
                Last Post Pattontje  
                Started by flybuzz, 04-21-2024, 04:07 PM
                17 responses
                230 views
                0 likes
                Last Post TradingLoss  
                Working...
                X