Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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:



    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 sidlercom80, 10-28-2023, 08:49 AM
            167 responses
            2,260 views
            0 likes
            Last Post jeronymite  
            Started by warreng86, 11-10-2020, 02:04 PM
            7 responses
            1,361 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by Perr0Grande, Today, 08:16 PM
            0 responses
            5 views
            0 likes
            Last Post Perr0Grande  
            Started by elderan, Today, 08:03 PM
            0 responses
            9 views
            0 likes
            Last Post elderan
            by elderan
             
            Started by algospoke, Today, 06:40 PM
            0 responses
            10 views
            0 likes
            Last Post algospoke  
            Working...
            X