Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add and BarsPeriod

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

    Add and BarsPeriod

    I want to make a strategy where the user will have the ability to set a time frame but I want to make sure that the time frame that they have chosen is not the chart time frame. In the documentation, it says that the BarsPeriod method should not be accessed from the initialize method but that the add method should. Essentially I need to check the chart time frame before running the Add method. How can I do this?

    #2
    Welcome to our forums here - programmatically this would not be possible, your understanding is correct. One way would be monitoring for the time frame chosen and then raising a runtime error that would not let the user proceed if the chart timeframe is chosen, or you would manage this process via user inputs from the UI.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Well I think this information should be accessible for a few reasons.

      1.)It is true that nt is still building the bars array but the base timeframe is known immediately and never changes.

      2.)The user has already selected this in his paramaters so that should be accessible.

      3.)It doesn't seem logical that I can't know what the current time frame is at the time that I need to define all of my time frames.

      Also is there a problem in having duplicate time frames? Could I define the chart time frame as an additional time frame?

      Comment


        #4
        Thanks for the feedback in this regard, this is noted on our feedback / enhancement tracking lists, however currently dynamic adding of series would not be supported unfortunately. You can internally add the series in again, however for realtime order submission the primary series should be used.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          My suggestion isn't necessarily to add time series dynamically (although this would be nice) but to have access to the chart timeframe at the time the timeseries is added. This would mean having access the chart time frame in the initialize method OR dynamically adding timeseries. Both would provide the needed result.

          Comment


            #6
            Originally posted by bfis108137 View Post
            My suggestion isn't necessarily to add time series dynamically (although this would be nice) but to have access to the chart timeframe at the time the timeseries is added. This would mean having access the chart time frame in the initialize method OR dynamically adding timeseries. Both would provide the needed result.
            Assuming that this could be done, what action did you intend to take if the time frames did clash? If you were going to issue a warning and bypass processing, then just do the same in OnStartUp() instead, or even in OBU when (CurrentBar == 0).

            Comment


              #7
              Essentially I would do nothing. If the user chose the timeframe of the chart then I would just not add that timeframe. Also I want access to the 1 minute bars for strategies that would work on ticks. I tried ticks and it's too slow. Anyways if the user chose 1 minute as the chart time frame then I would also know to not add that tf.

              Comment


                #8
                Originally posted by bfis108137 View Post
                Essentially I would do nothing. If the user chose the timeframe of the chart then I would just not add that timeframe. Also I want access to the 1 minute bars for strategies that would work on ticks. I tried ticks and it's too slow. Anyways if the user chose 1 minute as the chart time frame then I would also know to not add that tf.
                Then, no harm, no foul. the literature, distinctly says that if you add a time frame that already exists, it will essentially just be ignored anyway. As it says:

                "2. If a multi-series script adds an additional Bars object that already exists on the chart, the script will use the preexisting series instead of creating a new one to conserve memory. This includes that series' session template as applied from the chart."

                in the "Notes" section of the fourth folded section on this page of the NT Help: http://www.ninjatrader.com/support/h...nstruments.htm

                My suggestion would be to provide the user some notice, so that they can correct this if they desire, and just ignore it if that is their intent.
                Last edited by koganam; 01-02-2014, 01:26 PM.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GussJ, 03-04-2020, 03:11 PM
                11 responses
                3,227 views
                0 likes
                Last Post xiinteractive  
                Started by andrewtrades, Today, 04:57 PM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by chbruno, Today, 04:10 PM
                0 responses
                7 views
                0 likes
                Last Post chbruno
                by chbruno
                 
                Started by josh18955, 03-25-2023, 11:16 AM
                6 responses
                440 views
                0 likes
                Last Post Delerium  
                Started by FAQtrader, Today, 03:35 PM
                0 responses
                11 views
                0 likes
                Last Post FAQtrader  
                Working...
                X