• 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

Issues with data series between indicator and strategy

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

    Issues with data series between indicator and strategy

    My custom indicator is based on a 5 minute chart. To ensure my strategy shows an accurate move above or below price levels from the indicator I use OnEachTick

    Code:
    if (State == State.SetDefaults)
                {
                    Description                    = @"Sample strategy demonstrating how to call an exposed BoolSeries object";
                    Name                        = "RussellStrategy2019";
                    Calculate                    = Calculate.OnEachTick;
    I added a counter to my indicator with my price levels during the strategy test into my output and noticed that it's spitting out
    7745 iterations
    though this number should be around
    78 iterations
    . This of course seems to be an issue with attaching the data object of the indicator to a 5 minute chart and the strategy as it runs to OnEachTick .



    How do I ensure my indicator is using the 5 minute data object and the strategy itself which only uses the calculated price level values of the indicator uses OnEachTick?
    Last edited by hireforwebsite; 10-31-2019, 02:36 PM.

    #2
    Hello hireforwebsite,

    Thank you for your post.

    Is the strategy calling this indicator in anyway, or was it placed on the chart separately from the strategy?

    If the indicator is being called by the strategy it too will update on each tick.

    If you placed your counter inside OnBarUpdate of the indicator and it is updating on each tick, it will add an iteration each time a tick is recieved as that will trigger OnBarUpdate. Should you wish your iterator to only update once per bar, you may want to add an IsFirstTickOfBar check:

    https://ninjatrader.com/support/help...ttickofbar.htm

    Please let us know if we may be of further assistance to you.

    Kate W.NinjaTrader Customer Service

    Comment


      #3
      The indicator is called by the strategy like so
      Code:
      else if (State == State.Configure)
                  {
                      //AddChartIndicator(MACD(12,26,9));
                      AddChartIndicator(Russell_levels());
                      AddDataSeries("RTY 12-19", BarsPeriodType.Tick, 8);
                  }
      So, what way would I include the indicator in my strategy to receive the values but make sure the indicator is running off of a 5 minute chart?

      Comment


        #4
        Hello hireforwebsite,

        Thank you for your reply.

        An indicator being added via AddChartIndicator() cannot use any additional data series hosted by the calling strategy, but can only use the strategy's primary data series. What is the primary data series of the chart you're running the strategy on? Is this a 5 minute chart that you're using?

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Yes the strategy analyser is running with a 5minute chart

          Comment


            #6
            Hello hireforwebsite,

            Thank you for your reply.

            In that case, the indicator you've added to the chart through the strategy will be calculating on that five minute data series, yes. You're getting the prints you're seeing because you're running it on each tick on that data series, so it constantly updates with each tick that comes in, but it is basing its calculations on the 5 minute bars.

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Benjaminf, Today, 02:21 PM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Kate  
            Started by grayfrog, 05-24-2020, 09:29 PM
            5 responses
            31 views
            0 likes
            Last Post NinjaTrader_RyanS  
            Started by chrismcdermut, Today, 01:46 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Kate  
            Started by dpolyakov, Today, 01:13 PM
            3 responses
            14 views
            0 likes
            Last Post dpolyakov  
            Started by tjendra, Today, 12:15 PM
            3 responses
            10 views
            0 likes
            Last Post tjendra
            by tjendra
             
            Working...
            X