Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Synchronization between two indicators ?

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

    Synchronization between two indicators ?

    Hello NT,

    QUESTION:
    1) Lets assume I have two indicators. One called Source, and the other called SInk Both indicators update on a tick by tick basis. Both indicators implement "IsFirstTickOfBar" logic within "OnBarUpdate" to distinguish data relating to a new bar..

    2) Lets assume SInk inputs from Source output plot values.

    ASSUMPTION:
    Boolean variable "IsFirstTickOfBar" is autonomous per indicator. That is to say, there is no synchronization between separate indicators with the variable "IsFirstTickOfBar"


    As such, it is possible for Source indicator to output to its plot value, data that corresponds to a new "first tick of a new bar". While Sink indicator reads this new tick value, but might be under the assumption that it is still a tick update of the current bar it is processing.

    In other words, there is no synchroniztion of "IsFirstTickOfBar" between indicators.

    Is this correct ?

    #2
    Hello pvtrader,

    If you are calling a indicator from a host then the sub indicator will be run first so it can be calculated and return a value to the host.

    In your use case if Sink called Source then Source would be updated first and plot its value then Sink could read that value.

    IsFirstTickOfBar is a result of the bar processing and is not related to the indicators, if the bar which both indicators are now processing was the first tick then IsFirstTickOfBar will be true.

    Comment


      #3
      Hi Jesse.

      So ithe scenario I suggested above is possible. .There is no synchronization between "IsFirstTickOfBar" between indicators.

      Comment


        #4
        Hello pvtrader,

        In the described use case the indicators would be processing the same bar so they should see the same value. IsFirstTickOfBar is a bar property which relates to the bar data and where in processing the scripts are.

        Comment


          #5
          Hi Jesse,

          Assume the following:
          ------------------------------------
          1) I have a chart with multiple indicators.

          2)Each indicator uses "IsFirstTickOfBar" logic within "OnBarUpdate" to print a statement "Processing Start of New Bar" with CurrentBar value appended to it.

          3) Then I hit Reload ninjatrader Script.


          As the chart reloads, processing historical data, it is apparent one indicator may get ahead of another when processing bars..........




          (P.S.: I assume this is not a buffering issue with the print statement)

          Comment


            #6
            Hello pvtrader,

            That is a different use case, separately applied indicators are not in any kind of sync and are driven by bar events from the chart individually. They can finish loading in any order, that depends on what each scripts logic has to do and how long that takes.

            You originally mentioned:
            Code:
            Lets assume [B]SInk[/B] inputs from [B]Source[/B] output plot values.
            If you need two indicators to be in sync you need to call the other indicator from the parent indicator. Manually applied instances that are separate will otherwise process individually.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            650 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            370 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            109 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            574 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            577 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X