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:	152
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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        93 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        138 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        123 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        73 views
        0 likes
        Last Post PaulMohn  
        Working...
        X