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

some question about DValueArea indicator

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

    some question about DValueArea indicator

    I would like to use the DValueArea indicator with Strategy Builder
    https://ninjatraderecosystem.com/use...ad/dvaluearea/

    I have tried to display the following values:
    DValueArea1.RtPOC[0]
    DValueArea1.POC[0]
    DValueArea1.VAb[0]
    DValueArea1.VAt[0]

    However, these values are for the previous session. look at the images attached in the pdf file

    My first question is regarding the meaning of the following values:
    Profile Type : VOC, TPO, VWTPO, VTPO.
    When comparing these values with the Order Volume Profile in NinjaTrader, only VWTPO matches.


    My second question is: what does RtPOC mean?
    Additionally, I would like to know how to get the values RtPOC, POC, VAb, and VAt for the current session.with Strategy Builder
    Thank you in advance.



    Attached Files

    #2
    Hello aekzof,

    Thank you for your post.

    The Dvaluearea indicator you have linked to is simply a conversion of a NinjaTrader 7 version of a script that was originally created by the user DeanV. Typically, questions about scripts from the User App Share should be directed to the original author. You may find a link to their profile on the original script here:

    Display's day (session) based Value Area Profile info for the day's that include a few bars on the screen. For intra-day use. Version 7.0 – NT7 conversion of dValueArea. See previous posting for usage notes. Version 7.0.1 – Added "UseSessTemplate" override to replace session start/length times from templates. Version 7.0.2 – Added "ZOrder Put Behind". […]


    That said, I can answer some of your questions at least partially. You mentioned the values were for the previous session; based on your pdf file, I see that the indicator is set to calculate On Bar Close. If you would like real-time values you will need to set it to calculate On Each Tick instead.

    The values used in the Dvaluearea indicator may or may not match the Order Flow Volume Profile indicator in NinjaTrader. The logic for the Order Flow Volume Profile indicator is proprietary and not exposed, so there is no way to know if the Dvaluearea is calculating those values in the same way as the Order Flow Volume Profile or not.

    RtPOC is supposed to be Real-time POC (Point of Control). The Strategy Builder is able to work with plot values from an indicator; the RtPOC, POC, VAb, and VAt values are available in the indicator settings from the Strategy Builder under the Value Plot dropdown menu similar to the example shown in the help guide for comparing plot values of multi-plot indicators:Please let me know if I can be of further assistance.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your prompt response.

      Yes, this indicator contains four plots: RtPOC, POC, VAb, and VAt.
      With Strategy Builder, it is possible to display these values.
      However, the issue is that these values represent the previous session, not the current one.
      I am unsure if this is how the indicator is programmed or if there is something that I am missing.
      Code:
      namespace NinjaTrader.NinjaScript.Strategies
      {
          public class MyCustomStrategy : Strategy
          {
              private DValueArea DValueArea1;
      
              protected override void OnStateChange()
              {
                  if (State == State.SetDefaults)
                  {
                      Description                                    = @"Enter the description for your new custom Strategy here.";
                      Name                                        = "MyCustomStrategy";
                      Calculate                                    = Calculate.OnEachTick;
                      EntriesPerDirection                            = 1;
                      EntryHandling                                = EntryHandling.AllEntries;
                      IsExitOnSessionCloseStrategy                = true;
                      ExitOnSessionCloseSeconds                    = 30;
                      IsFillLimitOnTouch                            = false;
                      MaximumBarsLookBack                            = MaximumBarsLookBack.TwoHundredFiftySix;
                      OrderFillResolution                            = OrderFillResolution.Standard;
                      Slippage                                    = 0;
                      StartBehavior                                = StartBehavior.WaitUntilFlat;
                      TimeInForce                                    = TimeInForce.Gtc;
                      TraceOrders                                    = false;
                      RealtimeErrorHandling                        = RealtimeErrorHandling.StopCancelClose;
                      StopTargetHandling                            = StopTargetHandling.PerEntryExecution;
                      BarsRequiredToTrade                            = 20;
                      // Disable this property for performance gains in Strategy Analyzer optimizations
                      // See the Help Guide for additional information
                      IsInstantiatedOnEachOptimizationIteration    = true;
                  }
                  else if (State == State.Configure)
                  {
                  }
                  else if (State == State.DataLoaded)
                  {                
                      DValueArea1                = DValueArea(Close, 40, 2, 0, 2, false, @"08:30:00", 0.7, 2, 2, _dValueEnums.dValueAreaTypes.VWTPO, 0, 100, 1, 6.75, true, 2, false, 0, 60, 300, true, 2, false);
                  }
              }
      
              protected override void OnBarUpdate()
              {
                  if (BarsInProgress != 0)
                      return;
      
                  if (CurrentBars[0] < 1)
                      return;
      
                  Print(Convert.ToString(DValueArea1.RtPOC[0]));
                  Print(Convert.ToString(DValueArea1.POC[0]));
                  Print(Convert.ToString(DValueArea1.VAb[0]));
                  Print(Convert.ToString(DValueArea1.VAt[0]));
              }
          }
      }​

      Comment


        #4
        Hello aekzof,

        Thank you for your reply.

        I suggest adding the time of the bar to the prints as well. You may also check the box for "Plot on chart" to add the DValueArea indicator to your chart visually in order to compare the values with those shown in your print statements from the strategy. For more details on using prints to debug, including a video about adding prints in the Strategy Builder:If you are not seeing the indicator values updated in real-time on the chart with intra-day values, then that might mean you need to adjust the indicator settings. Ultimately, you may need to reach out to the original author for details on how to set up the indicator so it will calculate in real time. I do see that you have the strategy set to calculate on each tick, which means the indicator should be calculated on each tick as well. Adding more information to your prints and comparing them to the indicator values shown on the chart should help to better understand its behavior when used in the strategy.

        Please let us know if we may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Hi
          Apparently, this indicator only calculates plots for the previous session. I found a video from your college, Paul,
          that explains this. You can watch the video at this link https://paul-ninjatrader.tinytake.co...NV8xMDE4NzU1OQ

          After giving it some thought, I came up with a solution, but as a beginner, I'm not confident in implementing it. While examining the source code,
          I discovered the values for the current session.
          These values can be found in the function protected override void OnRender(ChartControl chartControl, ChartScale chartScale), specifically sessPriceOfPOC, sessVAbot, and sessVAtop.


          I printed these values, and they correspond to the tick-level order flow volume profile.


          Line 630
          Code:
          if (ShowEvolvingPOCs > 1 && x == sesNum.GetValueAt(CurrentBar))
                                  {
                                      if (EvolvingPOCColor != Brushes.Transparent)
                                          DrawEvolving(sesNum.GetValueAt(CurrentBar), ePOCBrush, sessPriceOfPOC);
                                      //Print("sessPriceOfPOC: " + sessPriceOfPOC);
                                      if (EvolvingVAbColor != Brushes.Transparent)
                                          DrawEvolving(sesNum.GetValueAt(CurrentBar), eVAbBrush, sessVAbot);
                                      //Print("sessVAbot: " + sessVAbot);
                                      if (EvolvingVAtColor != Brushes.Transparent)
                                      DrawEvolving(sesNum.GetValueAt(CurrentBar), eVAtBrush, sessVAtop);
                                          //Print("sessVAtop: " + sessVAtop);
                                  }​                            if (EvolvingVAtColor != Brushes.Transparent)​
          So, my solution involves adding three plots:


          Code:
          AddPlot(Brushes.Green, "CurrentPOC");
          AddPlot(Brushes.Green, "CurrentVAH");
          AddPlot(Brushes.Green, "CurrentVAL");


          In the protected override void OnBarUpdate() function, I assign the values to the new plots:


          Code:
          CurrentPOC[0] = vCurrentPOC; //sessPriceOfPOC
          CurrentVAH[0] = vCurrentVAH; //sessVAbot
          CurrentVAL[0] = vCurrentVAL; //sessVAtop




          However, the problem is that I can't access these values outside the OnRender function. If I display these values outside OnRender, I obtain the values from the previous session, which are assigned to the original plots of this indicator.

          I would greatly appreciate it if you could provide a solution. I have spent several hours trying, but I haven't been successful. Although I'm not too far along in my learning, I don't think I'll be able to find the solution myself.

          After conducting several searches, I found that this is the only free indicator that displays volume profiles. So, my request is to display these values within OnBarUpdate, and the rest should be straightforward. There are no issues with declaring the plots.

          Thank you for your assistance and the time you dedicate to helping us.

          Comment


            #6
            Hello aekzof,

            Thank you for your reply.

            Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Further, we do not provide C# programming education services or one on one educational support in our NinjaScript Support department. This is so that we can maintain a high level of service for all of our clients as well as our associates.

            That said, through email or on the forum we are happy to answer any questions you may have about NinjaScript if you decide to code this yourself. We are also happy to assist with finding resources in our help guide as well as simple examples, and we are happy to assist with guiding you through the debugging process to assist you with understanding unexpected behavior. I understand your question at the moment has to do with the values sessPriceOfPOC, sessVAbot, and sessVAtop. I see where you are referring to them in OnRender(), though that appears to only be a reference to the variables and the calculation to get those values is not done inside of OnRender(). It seems that you would need to figure out how to calculate the real-time/current session values and what you are asking to obtain the values and provide a solution requires more hands-on support than our team offers.

            You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our NinjaTrader Ecosystem team to follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.

            Please let me know if I may be of further assistance.​
            Emily C.NinjaTrader Customer Service

            Comment


              #7
              Hello,

              Thank you for your reply.​
              No problem, I comprehend the situation.

              I have successfully completed my script because, as you mentioned, I relied on reference values and I have acquired some understanding of how this indicator works.

              Just one last question, as you are aware, we can add indicators to the SuperDOM, such as the 'current day OHLC.'
              What are the conditions for the SuperDOM to accept these indicators?




              Regards.




              Click image for larger version  Name:	plot.png Views:	0 Size:	27.0 KB ID:	1259348





              Last edited by aekzof; 07-07-2023, 05:20 AM.

              Comment


                #8
                Hello aekzof,

                Thank you for your reply.

                For an indicator to be available in the SuperDOM, IsOverlay must be set to true:This will then allow indicator plots to be shown in the SuperDOM.

                Please let us know if we may be of further assistance.
                Emily C.NinjaTrader Customer Service

                Comment


                  #9
                  Thank you for your help

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by llanqui, Today, 11:13 AM
                  2 responses
                  3 views
                  0 likes
                  Last Post llanqui
                  by llanqui
                   
                  Started by samish18, 04-17-2024, 08:57 AM
                  25 responses
                  114 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by ETFVoyageur, 04-30-2024, 02:04 PM
                  6 responses
                  41 views
                  0 likes
                  Last Post ETFVoyageur  
                  Started by llanqui, 04-28-2024, 03:53 AM
                  5 responses
                  29 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
                  18 responses
                  57 views
                  0 likes
                  Last Post cmtjoancolmenero  
                  Working...
                  X