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 CaptainJack, 05-29-2026, 05:09 AM
            0 responses
            249 views
            0 likes
            Last Post CaptainJack  
            Started by CaptainJack, 05-29-2026, 12:02 AM
            0 responses
            161 views
            0 likes
            Last Post CaptainJack  
            Started by charlesugo_1, 05-26-2026, 05:03 PM
            0 responses
            165 views
            1 like
            Last Post charlesugo_1  
            Started by DannyP96, 05-18-2026, 02:38 PM
            1 response
            250 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            203 views
            0 likes
            Last Post CarlTrading  
            Working...
            X