Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OrderFlowCumulativeDelta delivers wrong values when hosted in indicator or strategy

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

    OrderFlowCumulativeDelta delivers wrong values when hosted in indicator or strategy

    Hi there, it's me again ;-)

    I am hosting an instance of OrderFlowCumulativeDelta inside a self-developed indicator to get the bar delta values for my own computations. Now when (State == State.Historical) everything works as expected. But when (State == State.Realtime), OrderFlowCumulativeDelta seems to publish wrong (i.e. outdated) values in the DeltaHigh / DeltaLow / DeltaClose series.

    I have attached an indicator to demonstrate the behavior. It hosts an instance of OrderFlowCumulativeDelta and also adds a volumetric bar series. It compares the OrderFlowCumulativeDelta values to the BarDelta values from the volumetric series, i.e. when (IsFirstTickOfBar && BarsInProgress == 0), it compares the values of the PREVIOUS (just closed) bars.

    Just add the indicator (Schwarzer/Experimental/HsCumulativeDeltaTest) to a chart with a small time interval (such as a 10s chart), and you will see. Historical: Values match. Realtime: Values don't match.

    I am aware of the fact that OrderFlowCumulativeDelta uses a 1-Tick data series internally, and I guess the problems are related to the behavior described in "Multi-Time Frame & Instruments". However, my understanding is that the ticks for the previous bar should have been processed by OrderFlowCumulativeDelta once I get the first tick of the new bar in the main series.

    Currently not a big problem, since the workaround is obvious: Just use volumetric bars to get the bar delta, it works as expected.

    Still, you might want to look into this since the behaviour of OrderFlowCumulativeDelta might not be as you intended.

    Regards,
    Heiko

    Attached Files

    #2
    Hello schwarzerh,

    Do you see the same problem if you apply the OrderFlowCumulativeDelta indicator to the chart and then compare the value with a volumetric chart rather than printing the value from your script?


    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      no, the values displayed by OrderFlowCumulativeDelta in the chart itself are correct, only the values published through the DeltaHigh / DeltaLow / DeltaOpen / DeltaClose properties of the OrderFlowCumulativeDelta indicator differ.

      As an experiment, I also verified the values from two bars ago, not just one bar ago on each first tick of a bar. They are also correct. Only the values of one bar ago differ if I check them on the first tick of a new bar. After some time, the values seem to "correct themselves".

      I guess OrderFlowCumulativeDelta or the underlying 1-Tick dataseries use some kind of write behind cache mechanism internally, which produces a lag.

      Try the indicator I attached to my first post, it writes the values to the output window, then you will see. It is also easy to modify the indicator so that it checks the values of two bars or three bars ago.

      Regards,
      Heiko


      Comment


        #4
        Hello schwarzerh,

        Do you see correct values if you do the print on the bar close rather than the first tick? Unfortunately these are closed source so I could not tell if doing something on the first tick would affect the result. Some indicators use the first tick as a reset so that point in time the value would not be accurate.

        JesseNinjaTrader Customer Service

        Comment


          #5
          Hi Jesse,

          sorry for the long pause, I was completely absorbed in a different project ...

          Regarding your suggestion, I just switched my little demo indicator to Calculate.OnBarClose. Still wrong delta values. If I use a NQ 10sec chart and display the values from 1 bar ago, there is usually a difference of 1 or 2 contracts. If I display the values for the current bar (OnBarClose), the difference is larger. So my hypothesis is still that there is an internal cache mechanism that "needs to catch up". However this seems to be solved somewhere internally, since the display of OrderflowCumulativeDelta in the chart itself ist correct.

          Also, OnBarClose or OnEachTick should not make a difference if I display the values for 1 bar ago on the first tick of the current bar.

          As an example, I want to color the bars of the price series differently if the volume is rising and the bar delta is either positive or negative. I want to to this already while the current bar is building, so I use Calculate.OnEachTick. But then, when I hit F5 to update the indicator, a lot of bars change their color, since the historical values are correct while the values that have been calculated real-time on each tick are not ...

          Regards,
          Heiko

          Comment


            #6
            Hello schwarzerh,

            Its possible that the indicator is re writing plot data on the first tick of the bar which is why the visual works, unfortunately I couldn't really say as this indicator is closed source so we cant see how it works internally.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by JoMoon2024, Today, 06:56 AM
            0 responses
            6 views
            0 likes
            Last Post JoMoon2024  
            Started by Haiasi, 04-25-2024, 06:53 PM
            2 responses
            18 views
            0 likes
            Last Post Massinisa  
            Started by Creamers, Today, 05:32 AM
            0 responses
            6 views
            0 likes
            Last Post Creamers  
            Started by Segwin, 05-07-2018, 02:15 PM
            12 responses
            1,786 views
            0 likes
            Last Post Leafcutter  
            Started by poplagelu, Today, 05:00 AM
            0 responses
            3 views
            0 likes
            Last Post poplagelu  
            Working...
            X