Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using QuantumCSI in and Strategy - Object reference not ser ERROR

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

    Using QuantumCSI in and Strategy - Object reference not ser ERROR

    Hi,

    I am trying to incorporate the third party QuantumCSI on my strategy. I used the Strategy Builder to see how to use the indicator. It compiles fine; however, when I try to run a backtest thru the Strategy Analyser, I get the following error:

    Indicator 'QuantumCSI". Error on calling "OnStageChange" method. Object reference not set to an instance of an object

    I appreciate if you could help me to resolve this error.

    Thanks,



    The following is the sample code

    //This namespace holds Strategies in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Strategies
    {
    public class STRR : Strategy
    {
    private QuantumCSI QuantumCSI1;

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Strategy here.";
    Name = "STRR";
    Calculate = Calculate.OnBarClose;
    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)
    {
    QuantumCSI1 = QuantumCSI(14, 60, true, true, true, true, true, true, true, true);
    }
    }

    protected override void OnBarUpdate()
    {
    if (CurrentBars[0] < 1)
    return;

    // Set 1
    if (QuantumCSI1.USD[0] > QuantumCSI1.USD[1])
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");
    }

    }
    }
    }

    #2
    Hello joevieira and thank you for your question.

    I noticed that you were checking to see if you had at least one bar on your chart. However I also noticed that you were using a 14 period indicator. Please ensure you have at least 14 bars available. If this doesn't resolve your query or there are other ways we could help please let us know.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Hi Jessica,

      I made a change to ensure I have at least 14 bars (if(CurrentBars[0] < 15) return). However, I am still getting the same error. Any help would be appreciated.

      Thanks,

      Joe

      Comment


        #4
        Thank you for this additional information. I am not familiar with the third party tool we are wrapping, and so I can only provide limited support from here. However, two other things we can attempt :

        • Ensure that your CurrentBar is greater than QuantumCSI1.BarsRequiredToTrade
        • Ensure that your CurrentBar is greater than 60 (the 2nd argument into your indicator)

        If neither of these approaches work, your strategy is simple enough that the third party add on vendor should be able to work with you if you can contact them directly. If they have any questions we could answer, we can be reached at platformsupport[at]ninjatrader[dot]com, referencing Attn:NinjaTrader_JessicaP and 1614339 in the subject line.
        Jessica P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        56 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        133 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X