Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    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:	75
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.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Balage0922, Today, 07:38 AM
        0 responses
        1 view
        0 likes
        Last Post Balage0922  
        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
        19 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  
        Working...
        X