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

Strategy that use an Indicator, how is the sync. between them?

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

    Strategy that use an Indicator, how is the sync. between them?

    Hi,

    I'm developing a strategy that gets it signals from an indicator.
    When the Strategy OnBarUpdate() is called, can I assume the indicator has already done its calculation and when the strategy will call the indicator, to gets its data, the OnBarUpdate() of the indicator was called?

    I tried to run it with a debugger and it doesn't look to be in sync.
    This mean that I have to put all the Indicator logic in the strategy?

    I'm a little confuse about it.

    Tx in advance!

    #2
    freewind, what are you trying to get from the indicator? A value / dataSeries it would plot or an exposed variable?

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand, I did know about the Update() method.

      In my design the indicator check if I should enter a position and the strategy handle the position.
      This is easier for me to break up the code.
      It is important for me that the indicator will have accurate data and will be sync. with the strategy series.
      If you have and more suggestions it will be great. In the mean time I'll play with the Update and see what results I'm getting.

      Tx!

      Comment


        #4
        Hello freewind, I do not see an sync issue per se, if you're working with multiple series it would be important to call the indicator value in the correct context - printing the value returned with the timestamp, BarsInProgress and CurrentBar would help understand the structure better.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          I see that the strategy OnBarUpdate() is called first(When I debug, the strategy breakpoint hit first).
          So if I have calculations in the indicator OnBarUpdate() which the strategy use, can I trust they are in sync.? is there some magic happens behind the scene? otherwise I don't understand it.

          Comment


            #6
            Originally posted by freewind View Post
            I see that the strategy OnBarUpdate() is called first(When I debug, the strategy breakpoint hit first).
            So if I have calculations in the indicator OnBarUpdate() which the strategy use, can I trust they are in sync.? is there some magic happens behind the scene? otherwise I don't understand it.
            This is really not well explained concept also for me.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by techgetgame, Today, 11:42 PM
            0 responses
            7 views
            0 likes
            Last Post techgetgame  
            Started by sephichapdson, Today, 11:36 PM
            0 responses
            1 view
            0 likes
            Last Post sephichapdson  
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,612 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            9 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            19 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Working...
            X