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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            154 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            306 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            244 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            345 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            176 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X