• 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

Indicator Sets Session Template

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

    Indicator Sets Session Template

    Is it possible to set the session template in an indicator? I have an indicator that requires different 24 hour sessions for ES, CL, ZN, ect...but I don't want to change the default instrument session template, which is the regular RTH hours. Only when I call this indicator do I want to use the 24 hour template.

    #2
    Originally posted by habibalex View Post
    Is it possible to set the session template in an indicator? I have an indicator that requires different 24 hour sessions for ES, CL, ZN, ect...but I don't want to change the default instrument session template, which is the regular RTH hours. Only when I call this indicator do I want to use the 24 hour template.

    You can select the session template for each bar series that has been added when you open a chart. The session template configures the bars, as the last bar of each session is cut off at the session break.

    If you add an indicator, this indicator will always use the session template of the bar series that is selected as input series for this indicator via the indicator dialogue box. The indicator cannot run on a different session template.

    A special case are multi-instrument indicators. If for an instrument no bar series has been added to the chart and if such a bar series for the instrument is loaded by the indicator itself, the session template stored under <instrument settings> will be used.

    For example it is impossible to calculate indicator values from an ETH session template and display those value on a chart that uses a RTH session template.
    Last edited by Harry; 01-01-2014, 03:40 PM.

    Comment


      #3
      NinjaTrader 8 Indicator using different Session Template to instrument's chart?

      Hi,

      Is it possible for an instrument's (e.g. ES) chart to be using a CME US Index Futures ETH session template but for an indicator to calculate the prior sessions OHLC based on the CME US Index Futures RTH session template? If so could someone kindly point me in the right direction please?

      Many Thanks.
      dowtrader

      Comment


        #4
        Hello dowtrader,

        Thank you for your post.

        It is possible to do this through NinjaTrader 8. You can add a bar series to the script of the instrument with the desired Trading Hours Template but you would need to hard code the instrument name and would not be able to dynamically apply the Trading Hours Template to any instrument without it being hard coded in the indicator. Please visit the following link for more information: https://ninjatrader.com/support/help...dataseries.htm

        In NinjaTrader 7 there is no option for this through the Add() function.

        Another alternative that would work in NinjaTrader 7 and NinjaTrader 8 is to use a time filter and assign the opening price to a variable, the closing price to a variable, and then calculate the highest high through the time range and the lowest low through the time range.

        For example:
        Code:
        		private double myTimeRangeOpen = 0;
        		private double myTimeRangeClose = 0;
        		private double myTimeRangeHigh = double.MinValue;
        		private double myTimeRangeLow = double.MaxValue;
        		protected override void OnBarUpdate()
        		{
        			if (ToTime(Time[0]) >= ToTime(9,0,0)
        				&& ToTime(Time[0]) <= ToTime(17,0,0))
        			{
        				if (myTimeRangeOpen == 0)
        					myTimeRangeOpen = Open[0];
        				
        				if (High[0] > myTimeRangeHigh)
        					myTimeRangeHigh = High[0];
        				
        				if (Low[0] < myTimeRangeLow)
        					myTimeRangeLow = Low[0];
        			}
        			if (ToTime(Time[0]) >= ToTime(17,0,0)
        				&& myTimeRangeClose == 0)
        				myTimeRangeClose = Close[0];
        		}
        Please let me know if you have any questions.
        Patrick H.NinjaTrader Customer Service

        Comment


          #5
          You don't need to hard code the FullName of the instrument on the chart which is Instrument.FullName. The trading hours argument of the method can be ANY valid session name from the list of available Trading Hours Templates but make sure you get all the characters exactly right. Refer to the documentation for the AddDataSeries method in the help guide. Have a nice Current Day, and Prior Day, too!

          Code:
                   ~ variable declarations ~
          
                   private string sessionStringE
          
                   ~ State.Configure ~
          
                   sessionStringE="CME US Index Futures ETH";
          			
          	 AddDataSeries
          		 (     Instrument.FullName,
          			new BarsPeriod() {BarsPeriodType = BarsPeriodType.Tick, Value = 1},					
          			sessionStringE				 
          		  );
          Attached Files
          Last edited by Ricam; 02-14-2018, 09:09 AM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by quantera, Today, 05:38 PM
          0 responses
          1 view
          0 likes
          Last Post quantera  
          Started by ciro1963, Today, 03:58 PM
          0 responses
          2 views
          0 likes
          Last Post ciro1963  
          Started by swcooke, Today, 02:48 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by SOFI777, Today, 01:03 PM
          5 responses
          29 views
          0 likes
          Last Post SOFI777
          by SOFI777
           
          Started by Gerard111, 09-23-2015, 07:25 AM
          2 responses
          1,207 views
          0 likes
          Last Post NinjaTrader_ChristopherD  
          Working...
          X