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

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);
    Paul H.NinjaTrader Customer Service

    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 fx.practic, 10-15-2013, 12:53 AM
            5 responses
            5,404 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by Shai Samuel, 07-02-2022, 02:46 PM
            4 responses
            95 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by DJ888, Yesterday, 10:57 PM
            0 responses
            7 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by MacDad, 02-25-2024, 11:48 PM
            7 responses
            159 views
            0 likes
            Last Post loganjarosz123  
            Started by Belfortbucks, Yesterday, 09:29 PM
            0 responses
            8 views
            0 likes
            Last Post Belfortbucks  
            Working...
            X