Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

values from cumdelta indicator are different in strategy

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

    values from cumdelta indicator are different in strategy


    Hi i spent whole day yesterday trying to figure out why strategy is printing wrong values on delta close and open. Still cant figure it out. Indicator plots correctly in datawindow and i compare it to other two. Strategy doesnt. Sometimes deltaOpen is matching but deltaclose never

    in indicator i am plotting these
    Code:
    // in setDefaults
    AddPlot(Brushes.Orange, "Deltaclose");
    AddPlot(Brushes.SpringGreen, "Deltaopen");
    AddPlot(Brushes.Transparent, "Deltalow");
    AddPlot(Brushes.Transparent, "Deltahigh");​
    if (BarsInProgress == 0)
    {
    Values[0][0] = OrderFlowCumulativeDelta(BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).DeltaClose[0];
    Values[1][0] = OrderFlowCumulativeDelta(BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).DeltaOpen[0];
    Values[2][0] = OrderFlowCumulativeDelta(BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).DeltaHigh[0];
    Values[3][0] = OrderFlowCumulativeDelta(BarsArray[0], CumulativeDeltaType.BidAsk, CumulativeDeltaPeriod.Session, 0).DeltaLow[0];​
    and in onBarupdate in my strategy i call those values and when i Print them and compare they dont match
    Code:
    Deltaclose = myCumulativeDelta.Deltaclose[0];
                Deltaopen = myCumulativeDelta.Deltaopen[0];
                Deltahigh = myCumulativeDelta.Deltahigh[0];
                Deltalow = myCumulativeDelta.Deltalow[0];
    
                DeltaclosePr = myCumulativeDelta.Deltaclose[1];
                DeltaopenPr = myCumulativeDelta.Deltaopen[1];​
    Click image for larger version  Name:	image.png Views:	0 Size:	1.46 MB ID:	1241656
    Last edited by tkaboris; 03-21-2023, 06:04 AM.

    #2
    Hello tkaboris,

    In the strategy you uploaded you are not using AddChartIndicator with the orderflow indicator or your custom indicator. You would need to use AddChartIndicator to ensure the same instance being used by the strategy is also being plotted on the chart. If you compare a manually applied indicator it will likely have different values, that applies to all indicators.

    Comment


      #3
      I added this to strategy and you were right it prints differnt values. The values that come from addchartindicator is not matching to Ninjatrader Cumulative delta. if I plot cumdelta seperatly it plots matching values to NT Cum Delta. What can be done?
      Code:
      else if (State == State.Configure)
                  {
                      Calculate                                    = Calculate.OnBarClose;
                      AddDataSeries(Data.BarsPeriodType.Tick, 1);
                      AddChartIndicator(BounceCumDelta());
                  }​
      Maybe its because my strategy is on barclose and indicaotor is on tick? if so how can i sync it
      Click image for larger version

Name:	image.png
Views:	149
Size:	111.4 KB
ID:	1241801
      Last edited by tkaboris; 03-21-2023, 01:19 PM.

      Comment


        #4
        Hello tkaboris,

        Do you see the same happening if you run the script OnEachTick? Unfortunately the orderflow items are not open source so I would not have any details on why it might not line up with the version you are plotting.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        81 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        64 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        68 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        55 views
        0 likes
        Last Post CarlTrading  
        Working...
        X