Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

VWAP indicator eating up memory

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

    VWAP indicator eating up memory

    I have developed a strategy based on the VWAP indicator. If I change the settings to calculate.oneachtick I frequently get the error "not enough quota..." and it takes forever to backtest or load charts. However, if the settings are calculate.onbarclose then the stoploss and setprofittargets do not trigger correctly. Is there something I'm overlooking about the strategy settings or the indicator that could be causing it to behave this way? I've looked at the code for the indicator, it doesn't seem so complicated that it would eat up memory like it does.

    Code:
    #region Using declarations
    
    using System;
    
    using System.Collections.Generic;
    
    using System.ComponentModel;
    
    using System.ComponentModel.DataAnnotations;
    
    using System.Linq;
    
    using System.Text;
    
    using System.Threading.Tasks;
    
    using System.Windows;
    
    using System.Windows.Input;
    
    using System.Windows.Media;
    
    using System.Xml.Serialization;
    
    using NinjaTrader.Cbi;
    
    using NinjaTrader.Gui;
    
    using NinjaTrader.Gui.Chart;
    
    using NinjaTrader.Gui.SuperDom;
    
    using NinjaTrader.Gui.Tools;
    
    using NinjaTrader.Data;
    
    using NinjaTrader.NinjaScript;
    
    using NinjaTrader.Core.FloatingPoint;
    
    using NinjaTrader.NinjaScript.Indicators;
    
    using NinjaTrader.NinjaScript.DrawingTools;
    
    #endregion
    
    
    
    
    //This namespace holds Strategies in this folder and is required. Do not change it.
    
    namespace NinjaTrader.NinjaScript.Strategies
    
    {
    
    public class vwap2 : Strategy
    
    {
    
    
    
    private VWAP VWAP1;
    
    
    
    
    private bool TradeSwitch;
    
    protected override void OnStateChange()
    
    {
    
    if (State == State.SetDefaults)
    
    {
    
    Description = @"Enter the description for your new custom Strategy here.";
    
    Name = "vwap2";
    
    Calculate = Calculate.OnBarClose;
    
    EntriesPerDirection = 1;
    
    EntryHandling = EntryHandling.AllEntries;
    
    IsExitOnSessionCloseStrategy = true;
    
    // ExitOnSessionCloseSeconds = 30;
    
    IsFillLimitOnTouch = true;
    
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    
    OrderFillResolution       = OrderFillResolution.Standard;              
    
        // OrderFillResolutionType   = BarsPeriodType.Tick;
    
        // OrderFillResolutionValue  = 1;      
    
    Slippage = 4;
    
    StartBehavior = StartBehavior.AdoptAccountPosition;
    
    IsAdoptAccountPositionAware = true;
    
    IncludeCommission = true;
    
    TimeInForce = TimeInForce.Day;
    
    TraceOrders = true;
    
    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;
    
    
    
    Loss = 300;
    
    LongProfitMultiplier = 2;
    
    
    
    
    
    
    
    }
    
    else if (State == State.Configure)
    
    {
    
    
    
    
    
    }
    
    else if (State == State.DataLoaded)
    
    {
    
    
    
    VWAP1 = VWAP(Close);
    
    
    
    AddChartIndicator(VWAP1);
    
    
    
    }
    
    }
    
    
    
    
    
    ​

    #2
    Hello zrobfrank,

    Thank you for your post.

    It appears you are using a third-party vwap indicator and not the Order Flow VWAP indicator that comes with NinjaTrader:


    In the case of a third party indicator, please refer to the developer of that indicator with any questions or concerns regarding that indicator's performance impact.

    Please let us know if we may be of further assistance.

    Comment


      #3
      Jiminy Christmas, I have to pay an additional $59/month to be able to use the native VWAP?

      Comment


        #4
        Originally posted by zrobfrank View Post
        Jiminy Christmas, I have to pay an additional $59/month to be able to use the native VWAP?
        Yes, the Order Flow+ tools are available either by purchasing the monthly account add-on or by purchasing a lifetime account plan. For more information, please see the help articles below:Please feel free to reach out with any additional questions or concerns.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        39 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        124 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        64 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        41 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X