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 pvincent, 06-23-2022, 12:53 PM
            14 responses
            238 views
            0 likes
            Last Post Nyman
            by Nyman
             
            Started by TraderG23, 12-08-2023, 07:56 AM
            9 responses
            383 views
            1 like
            Last Post Gavini
            by Gavini
             
            Started by oviejo, Today, 12:28 AM
            0 responses
            1 view
            0 likes
            Last Post oviejo
            by oviejo
             
            Started by pechtri, 06-22-2023, 02:31 AM
            10 responses
            125 views
            0 likes
            Last Post Leeroy_Jenkins  
            Started by judysamnt7, 03-13-2023, 09:11 AM
            4 responses
            59 views
            0 likes
            Last Post DynamicTest  
            Working...
            X