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 geddyisodin, Today, 05:20 AM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by Max238, Today, 01:28 AM
            3 responses
            30 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by timko, Today, 06:45 AM
            2 responses
            12 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by habeebft, Today, 07:27 AM
            0 responses
            4 views
            0 likes
            Last Post habeebft  
            Started by Tim-c, Today, 03:54 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Working...
            X