Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can a Calculation Process Be Stopped

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

    Can a Calculation Process Be Stopped


    if ((Times[3][0].TimeOfDay == anchorTime1.TimeOfDay)// this time start the calculation process
    && (Times[3][0].TimeOfDay <= StopTime1Plot.TimeOfDay)// I add this in attempt to stop the process but had no effect
    && (ShowAnchorONE == true))


    {
    iCumVolumeAT1 = Volumes[3][0];
    iCumTypicalVolumeAT1 = Volumes[3][0] * ((Highs[3][0] + Lows[3][0] + Closes[3][0]) / 3);
    }

    else
    {
    iCumVolumeAT1 = iCumVolumeAT1 + Volumes[3][0];
    iCumTypicalVolumeAT1 = iCumTypicalVolumeAT1 + (Volumes[3][0] * ((Highs[3][0] + Lows[3][0] + Closes[3][0]) / 3));
    }


    I was hoping to stop the process at a set time to SAVE on resources being used by NinjaTrader Platform

    This indicator has over 40 plots as the day progresses the older values are not longer needed (I know how to NOT show the Plot Values on the chart but that does not stop the Values from still being processed

    Thanks​

    #2
    Hello DTSSTS,

    Thanks for your post.

    You could set a value to the plot only during a certain timeframe by using a Time Filter condition and setting a value to the plot within that condition.

    For example:

    Code:
    if (((Times[0][0].TimeOfDay >= new TimeSpan(8, 0, 0))
    && (Times[0][0].TimeOfDay <= new TimeSpan(12, 0, 0))))
    {
        //assign value to plot
    Value[0] = Close[0];
    }


    By doing so, you will be setting a value to the plot only during the time filter you defined.

    Time Filter: https://ninjatrader.com/support/help...ateTimeFilters
    Value: https://ninjatrader.com/support/help.../nt8/value.htm
    ​Values: https://ninjatrader.com/support/help...nt8/values.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


      #3
      yes I am already Filtering that part, but that is still not stopping the process of running the calculations to create the value, VWAP requires alot of resources to kept the plot up to date,

      So I was hoping to actually stop the process in the area I posted

      Comment


        #4
        Additional Question

        When you do apply a Filter to NOT have the actaully Plot on the chart itself, I see in the data box n/a

        Thus that would also mean that if you were using conditions referencing that plot for example to be Plot < Close[0] and PLot > 0

        then the condition would not be mean as there is not plot, the plot can only be > 0 when it falls in the filter parameters

        Thanks

        Comment


          #5
          Hello DTSSTS,

          Thanks for your notes.

          I understand that you want to stop the indicator from processing to save resources and in this case, you would not set a value to the plot outside of your time filter condition.

          See this forum thread you created where my colleague Jesse provided advice for assigning a value to a plot during a certain timeframe: https://forum.ninjatrader.com/forum/...h-time-setting

          The strategy that the indicator is being used in should always be calling the indicator in OnBarUpdate() so that the indicator keeps up to date. You could make conditions in the strategy where the indicator is not called, but as soon as you call it in the future it will calculate the bars between the time you stopped calling it and the time you called it in the future to catch up.

          If the strategy has a time filter that controls when the indicator is called, it won't process on those bars. However, the indicator will update when you call the indicator again if it is a plot.

          You should allow the indicator to process because it will take time to calculate the values between when you stop calling it and when it is called again in your logic. If the indicator stops plotting in its logic then the strategy would have to wait till it's not an n/a value to be able to use it in conditions. It is better to follow the standard pattern of calling the indicator on each bar and having the indicator plot a value for each bar.

          It shouldn't take a lot of resources to process an indicator in realtime. If you mean it takes long time to load, that might be expected depending on what it is doing and the machine's hardware. In realtime it should at most be getting tick-level data updates which can cause a lot of calculations but it should still be pretty efficient.
          Last edited by NinjaTrader_BrandonH; 05-03-2023, 12:28 PM.
          <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


            #6
            ok thanks, the jesse post is what I am doing

            Comment


              #7
              Still not Clear on this What I want is to set the Plots NOT to Plot with the filter. Each plot is only allow a very short time to plot, the a new time plot begins a new plot

              So if the older plot is filtered out then It will have the n/a for a value and not be considered in Strategy looking for the current plot to the current condition set a the appropriate time

              Additional Question

              When you do apply a Filter to NOT have the actaully Plot on the chart itself, I see in the data box n/a

              Thus that would also mean that if you were using conditions referencing that plot for example to be Plot < Close[0] and PLot > 0

              then the condition would not be mean as there is not plot, the plot can only be > 0 when it falls in the filter parameters

              ************************************************** *************************

              BUT I am not sure if a different approach might can be taken to the every changing time. Possible a Plot could start at 01:00 and reset and restart at 1:30 etc and ONLY have ONE Plot​

              Comment


                #8
                Disregard Post 7 I am going to reset and restart ONE Plot

                Comment


                  #9
                  Hello DTSSTS,

                  Thanks for your notes.

                  Assigning values to a plot within a time filter condition means the plot would only plot on the chart during that timeframe.

                  I have attached an example script that you might find helpful that demonstrates how to use a time filter to control when the indicator plots on the chart.

                  When running the example script, we can see that if the time is between 8:00AM and 11:00AM, the plot appears on the chart. Once the time is between 11:00AM and 12:00PM, the plot is not plotted on the chart since a value is not assigned to the plot.

                  When the time is between 12:00PM and 1:30PM, the plot appears on the chart. Once the time is between 1:30PM and 2:00PM, the plot no longer plots on the chart.

                  When the time is between 2:00PM and 3:00PM, the plot appears on the chart again.
                  Attached Files
                  <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


                    #10
                    Yes I did what you describe in Post 9 on the last indicator I created, it all worked well ty

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    607 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    353 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    105 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    560 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    561 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X