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 cmoran13, 04-16-2026, 01:02 PM
            0 responses
            42 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            25 views
            0 likes
            Last Post PaulMohn  
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            162 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            98 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            157 views
            2 likes
            Last Post CaptainJack  
            Working...
            X