Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help how can I on a volumetric chart find out the price of the maximum delta.

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

    Help how can I on a volumetric chart find out the price of the maximum delta.

    Help, in ninjascript, how can I on a volumetric chart find out the price of the maximum delta.
    This function looks for the max and min delta but not the price.
    Print("Maximum Positive Delta: " + barsType.Volumes[CurrentBar].GetMaximumPositiveDelta());
    Print("Maximum Negative Delta: " + barsType.Volumes[CurrentBar].GetMaximumNegativeDelta());
    Thank you very much

    #2
    Hello disfor,

    Thanks for your post and welcome to the NinjaTrader Forums!

    The Max and Min do not occur at a price level as this represents the bar.

    I think you want to loop through all prices in the bar and determine the largest and smallest delta for individual prices, not whole bar

    double maxdelta = maxprice = double.MinValue;
    double mindelta = minprice = double.MaxValue;
    for (double p = High[0]; p >= Low[0]; p -= TickSize)
    {
    if (barsType.Volumes[CurrentBar].GetDeltaForPrice(p) > maxdelta)
    {
    maxdelta = barsType.Volumes[CurrentBar].GetDeltaForPrice(p);
    maxprice = p;
    }

    if (barsType.Volumes[CurrentBar].GetDeltaForPrice(p) < mindelta)
    {
    mindelta = barsType.Volumes[CurrentBar].GetDeltaForPrice(p);
    minprice = p;
    }
    }
    Print(CurrentBar + " " + maxdelta + " " + maxprice);
    Print(CurrentBar + " " + mindelta + " " + minprice);

    Comment


      #3
      Hello PaulH,
      Thank you very much for your help.
      I have a bug in the compilation
      Thanks

      Comment


        #4
        Hello Paul H.
        solved, it works perfectly, thank you very much.
        double maxprice
        double minprice

        Comment


          #5
          Does the example that _PaulH provided work if implemented in a drawing tool? I have tried including it in mine but the "TickSize" is causing a compilation error.

          Comment


            #6
            Error fixed, I used: AttachedTo.Instrument.MasterInstrument.TickSize;

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            571 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
            548 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            549 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X