• 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

The problem with invoking the data flow from the indicator in the strategy

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

    The problem with invoking the data flow from the indicator in the strategy

    Hello, the problem is that the output of the indicator goes continuously (screen here https://prnt.sc/ptpv2z) , but if you call the indicator data from the strategy you get the following https://prnt.sc/pw6rt1
    Unfortunately I can't show the original code, but I can say that the variable for the output values is defined like this

    if (Disbalance_list.ContainsKey(tempTickNumP)) {
    myDisbalance = Disbalance_list[tempTickNumP];}
    balance[0] = myDisbalance;

    And then I create a property

    [Browsable(false)]
    [XmlIgnore()]
    public DataSeries balance
    {
    get { return Values[0]; }
    }

    I should add that this piece of code -

    if (Disbalance_list.ContainsKey(tempTickNumP)) {
    myDisbalance = Disbalance_list[tempTickNumP];}
    balance[0] = myDisbalance;

    is in the public override void Plot method, and in strategy I call it in OnBarUpdate

    Maybe that's the problem...? Please help to solve it

    #2
    Hello Papercut110,

    Thank you for your post.

    To clarify, are you actually referring to an instance of the indicator called by the strategy, or are you doing the strategy calculations within the strategy itself?

    What is the Calculate setting of the indicator? How about the strategy?

    Are there any additional data series called by your strategy or the indicator itself? If so, what? What interval do you usually use for the primary data series (1 minute, 4 renko, etc)?

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

    Comment


      #3
      NinjaTrader_Kate, All calculations are carried out exclusively in the indicator, CalculateOnBarClose = false, the indicator uses two timeframes, the main one is 1 minute, the additional one is 1 tick, in the strategy, I did not add anything at all, just called the indicator...

      Comment


        #4
        Hello Papercut110,

        Thank you for your reply.

        To clarify, are both the strategy and the indicator set to CalculateOnBarClose = false, or is it just the indicator that is set this way?

        If the strategy is set to update OnBarClose but the indicator isn't, I'd expect it to print similarly to what you're experiencing. Can you confirm what your settings are?

        Thanks in advance; I look forward to assisting you further.
        Last edited by NinjaTrader_Kate; 11-13-2019, 12:21 PM.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          NinjaTrader_Kate, Both in the indicator and in the strategyCalculateOnBarClose = false. When observing the output values of the indicator, it is noticeable that they change more often. It seems that perhaps the method in the strategy restricts the change of the incoming data...I tried to call the indicator in OnMarketDepth, but to no avail, although maybe I was doing something wrong. If it helps, I can record a video.

          Comment


            #6
            Hello Papercut110,

            Thank you for your reply.

            I've created a quick super simple test strategy and indicator. Please try running this strategy on a 1 minute data series - if you look in the output window do you see this running as you would expect? Does this differ from how your strategy is behaving?

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

            Comment


              #7
              NinjaTrader_Kate, I made my print, this is how it looks to me https://prnt.sc/px6fc8

              And another interesting note - in your version of the strategy, you do not add an indicator to the Initialize method, it does not work for me, so I have to add Add(Indicator()); to the Initialize method...

              Comment


                #8
                Hello Papercut110,

                Thank you for your reply.

                Ah, I understand more fully. Your previous statement that "I did not add anything at all, just called the indicator" was why I set it up that way. I've attached a revised copy that hosts the indicator rather than just calls it. This one also attaches the TestVol indicator to the chart and also renders some text showing the current value of TestVol called from the strategy to the chart. You should see them update at the same time if everything is working correctly.

                Add() adds an indicator to the strategy only for the purpose of displaying it on a chart.

                It appears the prints you provided were from historical data, is that correct?

                When indicators or strategies are running on historical data, OnBarUpdate() is only called on the close of each historical bar even if this property is set to false. This is due to the fact that with a historical data set, only the OHLCVT of the bar is known and not each tick that made up the bar. How do the prints look when they are running on real time data?

                Thanks in advance; I look forward to assisting you.


                Attached Files
                Kate W.NinjaTrader Customer Service

                Comment


                  #9
                  NinjaTrader_Kate, good day! I use Market Replay Connection, so, unfortunately, I think that the problem is not the historical data. But just in case I did as in your example - "myAlexPotok.Update();" https://prnt.sc/py19v7


                  Last edited by Papercut110; 11-16-2019, 11:45 PM.

                  Comment


                    #10
                    I can not understand why the strategy skips parts of the indicator data...
                    In the indicator I use Value.Set(AlexPotok()); in the method public override void Plot - could it have something to do with the data gap?
                    Last edited by Papercut110; 11-16-2019, 11:56 PM.

                    Comment


                      #11
                      Hello Papercut110,

                      Thank you for your reply.

                      There is no way to tell when the Plot() method will get called, so it is very possible that you could be missing data in your values. While it is generally safe to say that if something causes the chart to draw, move, price change, so forth that the Plot() will get called, you're needing to ensure that you're getting the values you expect.

                      In order to ensure the value gets updated along with the bars, you'd want to have Value.Set in your OnBarUpdate method - this way you ensure that something is assigned each bar update.

                      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 tvaughan4, Today, 10:46 PM
                      0 responses
                      0 views
                      0 likes
                      Last Post tvaughan4  
                      Started by digibob, Today, 10:01 PM
                      0 responses
                      1 view
                      0 likes
                      Last Post digibob
                      by digibob
                       
                      Started by ptertich, Today, 09:59 PM
                      0 responses
                      1 view
                      0 likes
                      Last Post ptertich  
                      Started by sledge, Today, 06:11 PM
                      1 response
                      9 views
                      0 likes
                      Last Post sledge
                      by sledge
                       
                      Started by Bionian, Today, 02:46 PM
                      2 responses
                      9 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Working...
                      X