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:	143
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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        53 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        130 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        70 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        44 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X