Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

add the Value Area High - Low to the indicator.

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

    add the Value Area High - Low to the indicator.

    Hello everyone, help me implement (find the formula) add the Value Area High - Low to the indicator.

    Any help where you can start is welcome, I attach the indicator.

    https://ninjatraderecosystem.com/use...oad/dpoc-line/

    ps I know that there are built-in indicators showing what I need, but I need to add it to this indicator in order to then implement it into another indicator.
    Attached Files
    Last edited by memonolog; 03-26-2021, 04:26 AM.

    #2
    Found a formula

    Code:
    void GetValueArea(int i, double tickSize)
    {
    if (dictionaryList[i].Count > 0 && poc != 0)
    {
    int highIdx = 0;
    int lowIdx = 0;
    long upTestV = 0;
    long dnTestV = 0;
    long valueVol = 0;
    long areaVol = 0;
    valueAreaHigh = 0;
    valueAreaLow = 0;
    
    List<double> priceList = new List<double>();
    
    foreach (KeyValuePair<double, VolItem> element in dictionaryList[i])
    {
    valueVol += element.Value.total;
    priceList.Add(element.Key);
    }
    valueVol = (long)(valueVol * 1);
    priceList.Sort();
    
    for (int n = 0; n <= priceList.Count - 1; ++n)
    {
    if (priceList[n] == poc)
    {
    highIdx = n;
    lowIdx = highIdx;
    break;
    }
    }
    areaVol = dictionaryList[i][poc].total;
    
    while (areaVol < valueVol)
    {
    if (upTestV == 0)
    {
    for (int n = 1; (n <= 1 && highIdx < priceList.Count - 1); ++n)
    {
    upTestV += dictionaryList[i][priceList[highIdx + 1]].total;
    ++highIdx;
    }
    }
    
    if (dnTestV == 0)
    {
    for (int n = 1; (n <= 1 && lowIdx > 0); ++n)
    {
    dnTestV += dictionaryList[i][priceList[lowIdx - 1]].total;
    --lowIdx;
    }
    }
    
    if (upTestV > dnTestV)
    {
    areaVol += upTestV;
    upTestV = 0;
    }
    else
    {
    areaVol += dnTestV;
    dnTestV = 0;
    }
    }
    valueAreaHigh = priceList[highIdx];
    valueAreaLow = priceList[lowIdx];
    }
    }
    but don’t know how to connect correctly
    please, help

    Attached Files

    Comment


      #3
      Hello memonolog,

      Can you clarify what you need help with here? The first script you provided has the method you pasted in post 2. I would not know how that works to advise if that is correct or not but it appears to already be in that script, if you are asking how to use it that would be how.

      Thats a C# method so if you wanted to use it you would need to call the method:

      GetValueArea(1,1);

      The parameters you would need to figure out what is needed, it mentions int i which is not descriptive and a tick size so the second parameter may need to be TickSize. If that was taken from another script I would suggest looking at the original script and how that method was used.



      Please let me know if I may be of further assistance.

      Comment


        #4
        Originally posted by NinjaTrader_Jesse View Post
        Hello memonolog,

        Can you clarify what you need help with here? The first script you provided has the method you pasted in post 2. I would not know how that works to advise if that is correct or not but it appears to already be in that script, if you are asking how to use it that would be how.

        Thats a C# method so if you wanted to use it you would need to call the method:

        GetValueArea(1,1);

        The parameters you would need to figure out what is needed, it mentions int i which is not descriptive and a tick size so the second parameter may need to be TickSize. If that was taken from another script I would suggest looking at the original script and how that method was used.



        Please let me know if I may be of further assistance.
        1)

        I pasted this code from another indicator, I don’t know how to connect to Dict which is used to define POC - cacheDictionary
        in the indicator

        need help

        2)
        is there access from the built-in market profile which is the Order Flow Volume Profile?

        for example, I want to call the last POC of the day, like how we can call for example the last high of the day from the indicator

        double priorDaysLow = PriorDayOHLC().PriorLow[0];

        Is it possible to call the POC and Value Area of ​​the previous day using the same method
        if so, what would be the syntax?

        Comment


          #5
          Hello memonolog,

          1) If you copied that from another indicator you would need to reference the original to see how that was used. I couldn't say based on just the method aside from you would need to call that method in some way and you would also need any variables which that method used added to your script. Its likely easiest to make a copy of the whole original script and then edit that as needed.

          2) Not currently. The POC and value area are not currently exposed for NinjaScript use.

          Please let me know if I may be of further assistance.

          Comment


            #6
            Originally posted by NinjaTrader_Jesse View Post
            Hello memonolog,

            1) If you copied that from another indicator you would need to reference the original to see how that was used. I couldn't say based on just the method aside from you would need to call that method in some way and you would also need any variables which that method used added to your script. Its likely easiest to make a copy of the whole original script and then edit that as needed.

            2) Not currently. The POC and value area are not currently exposed for NinjaScript use.

            Please let me know if I may be of further assistance.

            Unfortunately my knowledge is not enough...

            here is the original indicator from which I took the code, if someone will help integrate into my code, for educational purposes I will be very grateful

            Attached Files

            Comment


              #7
              Hello memonolog,

              In the file provided you can use Control + F to find where the method was used to see how you may want to use it. As this method was developed for the script you attached it likely can't just be copied/pasted into a different script. A better approach would be to make a copy of this indicator and make the edits you need to that.

              Please let me know if I may be of further assistance.

              Comment


                #8
                Originally posted by NinjaTrader_Jesse View Post
                Hello memonolog,

                In the file provided you can use Control + F to find where the method was used to see how you may want to use it. As this method was developed for the script you attached it likely can't just be copied/pasted into a different script. A better approach would be to make a copy of this indicator and make the edits you need to that.

                Please let me know if I may be of further assistance.
                the problem is that I cannot take the code from the indicator above, since it uses Onrender, and my code in the first post is based on BIP.

                there is a profile as the bars are displayed (appearing) on ​​the chart), that is, there it is like everything is dynamically done using Onrender in which I have zero experience at all.

                Comment


                  #9
                  Hello memonolog,

                  Right, that method was developed for that script to be used with OnRender. If you wanted to do something similar you would have to make your script in a similar way to be able to use that. You could try and learn from the concepts it uses to make your own code but that would require stepping through that logic and figuring it out yourself.

                  If you are using OBU logic then to render a profile like that indicator you would be required to use OnRender. There is no drawing object that can be used from OBU that would produce the same result as OnRenders custom drawing.


                  Please let me know if I may be of further assistance.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  637 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  366 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  107 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  569 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  572 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X