Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OrderFlowCumulativeDelta - Close of Bar

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

    OrderFlowCumulativeDelta - Close of Bar

    Hello,

    I´m plotting an easy condition from an indicator because I experienced unexpected behavior. In the attached screenshot one can see how it is plotting from this little code...it is plotting ok for delta-down-bar, but it is not plotting for delta-up-bar (close above prior high). The code to debug is simply:

    else if (State == State.DataLoaded)
    {
    OrderFlowCumulativeDelta1 = OrderFlowCumulativeDelta(Closes[0], NinjaTrader.NinjaScript.Indicators.CumulativeDelta Type.BidAsk, NinjaTrader.NinjaScript.Indicators.CumulativeDelta Period.Session, 0);
    ....
    if(Closes[0][0]<Highs[0][0])
    {if(OrderFlowCumulativeDelta1.DeltaClose[0] < OrderFlowCumulativeDelta1.DeltaLow[1])
    BackBrushes[0]=Brushes.Red;
    }
    else if(Closes[0][0]>Lows[0][0])
    {if(OrderFlowCumulativeDelta1.DeltaClose[0] > OrderFlowCumulativeDelta1.DeltaHigh[1])
    BackBrushes[0]=Brushes.ForestGreen;
    }

    if (BarsInProgress == 1)
    {OrderFlowCumulativeDelta1.Update(OrderFlowCumulat i veDelta1.BarsArray[1].Count - 1, 1);}

    What might be the reason why it is not plottinig green if the close of OFCD is above the prior CD-bar-high?

    Thank you!
    Tony
    Attached Files

    #2
    Hi Tony, thanks for posting.

    If you print out data within the condition does it print? That would prove the condition is indeed being hit. You can try:

    Code:
    if(Closes[0][0]>Lows[0][0])
    {
    if(OrderFlowCumulativeDelta1.DeltaClose[0] > OrderFlowCumulativeDelta1.DeltaHigh[1])
    {
        Print("Condition Reached");
        Print(OrderFlowCumulativeDelta1.DeltaClose[0]);
        Print(OrderFlowCumulativeDelta1.DeltaHigh[1]);
        BackBrushes[0]=Brushes.ForestGreen;
    }
    }

    Comment


      #3
      Hello,

      thank you for your reply. This moment I wanted to add that I found the reason. Its - of course - the "if...else if".

      As I was using it on Rangebars untill now this was never an issue, but on this tickchart the "else if" will not be touched when the the "if" is true with the close below the high (even whent its an upbar)

      Thank you for your support!
      Tony

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      566 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      330 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      547 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      548 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X