Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

VWAP Modification

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

    #76
    Above where in State.DataLoaded you wrote:

    ATSFloatingAnchors1 = ATSFloatingAnchors(Close, true, true, true, 120, true, 78, true, 78, true, 78);

    Just add right below that:

    AddChartIndicator(ATSFloatingAnchors1);
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #77
      Thanks I normally do not Plot on Chart, so when I copied the code from my script builder I only used a few of the plots and not all, so I missed that line of code at the bottom

      so AddChartIndicator(ATSFloatingAnchors1); now added and I see the Plots

      so now back to the issue - the plots are not working correctly as they do when the Indicator is applied to the chart​

      I HAVE THE Actual indicator on the chart and the Indicator applied to the chart from the Strategy

      I have multiple days of history and the plots are to the penny Regular hours and Extended Session plots

      AT Start of current session 5/1/2/23 18:00 the Strategy applied Indicator on the chart Stops Calculating (the plot flat lines at the time)

      Other prior days extended session plots are the same from the chart Indicator and from the Strategy apply Indicator Plot (only the Current extended session is not changing

      Thanks

      I think i see the issue
      Last edited by DTSSTS; 05-02-2023, 06:51 AM.

      Comment


        #78
        Post Do orders rest at the exchange, broker or on your PC? I do not see the issue with the plots stop calculation at 18:00 start of current session

        Comment


          #79
          Bruce was this your post, I think we posted at same exact time and they merged

          Post Do orders rest at the exchange, broker or on your PC?

          Comment


            #80
            Hello DTSSTS,

            Thanks for your note.

            Each post created by a NinjaTrader Forums member would be posted separately and would not be merged into the same post.

            If the script is not plotting as expected then you would need to further debug your script by adding prints to understand the script's behavior. Add prints to the script that print out the values that you note are not behaving as expected along with the Time.

            Below is a link to a forum post that demonstrates how to use prints to understand behavior.
            https://ninjatrader.com/support/foru...121#post791121
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment


              #81
              something merged - I DID NOT TYPE THIS in my post
              Do orders rest at the exchange, broker or on your PC?
              and it is colored red which is also different - not sure where that came from

              to confirm I can add prints to strategies
              the prints from the indicator I can see as I load the strategy and they were correct. the plots are correct from the strategy applied to the with the Plot on Chart AddChartIndicator

              Every days history is correct UNTIL THE start of the current session - so something about the addeddataseries that apply to the indicator nestled dataseries have to be the cause of this

              THIS WOULD LIKELY BE A BarsInProgress issue I would think when the indicator is applied into a Strategy
              thanks
              Last edited by DTSSTS; 05-02-2023, 08:20 AM.

              Comment


                #82
                When I change the actaul Chart that the strategy is applied to from a Extended hours chart to at Regular Hours Chart

                All the Plots are as expected and NOT a flat line (no changing ) plot

                Comment


                  #83
                  Hello DTSSTS,

                  Thanks for your note.

                  Yes, prints can be added to a strategy to understand how the strategy is behaving.

                  Please review the forum post link I shared in post # 80 that demonstrates how to use prints to understand behavior.

                  To understand exactly how all of the values, conditions, and plots in your strategy are behaving you would need to further debug your strategy by adding prints in the strategy that print out all the values and the Time.
                  <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                  Comment


                    #84
                    you had no comment about the fact that I change my chart from extend to regular hours and all the plots are as expected.

                    NOW I change the chart back to Extended Hours (where previously the Plots were NOT changing throughout the overnight session)

                    and NOW they are as expected throughout the overnight session and the current regular hours session. THAT MAKE NO SENSE

                    Comment


                      #85
                      Hello DTSSTS,

                      Thanks for your notes.

                      The script could behave differently when applied to a chart that uses a regular hours trading hours template compared to a chart using an extended hours trading hours template since the data loaded on the chart is different between the two trading hours templates. When you change the trading hours template, more or less bars will be loaded on the chart which will change the indicator values and other logic you use.

                      To know what exactly is different in the script when comparing it on a regular hours trading hours chart versus an extended hours trading hours chart, you must add further debugging prints to the script that print out all of the values being used in your logic to see what exactly in the script is calculating differently.
                      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                      Comment


                        #86
                        thanks but my point was that the Extended hours was not update the plots, then after switching to RTH, (data reloaded) then the plots were as expected
                        then switching back to Extended hours the date reloaded and the plots were then as expected,

                        THUS the plots DID NOT update until data reloaded, the has to have something to do with bars updating the script, The indicator works perfect when applied to a chart
                        but in the strategy the bars are not updating the code to update the plots

                        Mostly in the past I have not used BarsInProgress very much in Strategy codes, COULD this USAGE be approached differently

                        Is there a way to early in the code to have an area that is updating the indicator each bar of the related data series

                        this indicator has 6 dataseries and each condition sets that create each of the six plots uses

                        if (BarsInProgress == 3)
                        or
                        if (BarsInProgress == 4)
                        etc

                        thanks

                        Comment


                          #87
                          is this applicable

                          barsRequest.Update += OnBarUpdate;

                          Comment


                            #88
                            Hello DTSSTS,

                            Thanks for your note.

                            Since you are using AddChartIndicator in a strategy, you need to call the indicator from OnBarUpdate() to have it update and calculate.

                            You could consider calling ATSFloatingAnchors1.Update(); in OnBarUpdate() or you could use it in a condition or you could assign it to a local double variable.

                            See this help guide about .Update(): https://ninjatrader.com/support/help...nt8/update.htm
                            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                            Comment


                              #89
                              My prints are showing the plot values are as expected so I would think when they were flat lined they were not updating
                              I using AddChartIndicator is the only thing requiring me to consider ATSFloatingAnchors1.Update();

                              I only added that to see if the plots were correct. SO IT THAT WHAT IS CAUSING THEM TO BE NOT UPDATED? I do not need to see the plots, I just need to know they are correct as expected

                              this makes sense ATSFloatingAnchors1.Update();

                              but other than placing ATSFloatingAnchors1.Update(); as a line of code after OnBarUpdate() I have no Idea what you mean by the use as a condition

                              the help page really as many times is the cause is just so limited that it does not point the way to a solution

                              you could assign it to a local double variable. AGAIN no clue what this suggests

                              thanks

                              Comment


                                #90
                                Hello DTSSTS,

                                Thanks for your note.

                                The .Update() method forces the OnBarUpdate() method to be called for all data series so that indicator values are updated to the current bar index. If the values are already up to date, the Update() method will not be run.

                                When using AddChartIndicator in a strategy then you should call the indicator from OnBarUpdate() to have it update and calculate.

                                This is as simple as using the indicator in a condition. For example:

                                if (ATSFloatingAnchors1.Value[0] > 0)
                                {
                                //do something here.
                                }

                                Or, assigning the indicator to a local double variable. For example, double myIndicatorValue = ATSFloatingAnchors1.Value[0];.

                                Or, by calling .Update() on your indicator in OnBarUpdate(). For example, ATSFloatingAnchors1.Update();.

                                If you do not need to see the plots in the strategy, you could consider removing AddChartIndicator() from the script.
                                <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                                Comment

                                Latest Posts

                                Collapse

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