Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding an indicator in a strategy - abort, retry, ignore

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

    Adding an indicator in a strategy - abort, retry, ignore

    I just wrote an indicator and tested it on a chart and it all looks OK.

    I then added it to a strategy so I can compare the indicator to the trades, but it throws this error:

    Assertion failed: abort, retry, ignore?
    IndicatorBase.InputInitialize
    followed by a stacktrace.

    I tried removing all my script from my indicator so that it's just a shell with nothing in the event methods, but it still happens.

    I have added it in the same way in the strategy's initialize method as I added the other indicators I am using.

    What is this InputInitialize assertion? What am I doing wrong or is there any way I can fix this?

    Thanks

    #2
    Hi adamus,

    Can you please clarify how you "added this to a strategy"? Did you move code to the strategy? Call if from a strategy?
    TimNinjaTrader Customer Service

    Comment


      #3
      It's the indicator called PivotPoint. This is the code from my strategy. The volatility indicator is added fine, the PivotPoint crashes it:

      Code:
      [FONT=Courier New]        private Indicator.Indicator pivotPoint;
              private Indicator.Indicator volatility;
              // time frame / barsInProgress / Bars index
              private int longTF = 0;
              private int oneMin = 1;
              private OrderBook orderBook;
              private List<double> widths = new List<double>();
      
              protected override void Initialize()
              {
                  TraceOrders = false;
                  CalculateOnBarClose = true;
                  TimeInForce = Cbi.TimeInForce.Gtc;
                  ExitOnClose = false;
                  Add(PeriodType.Minute, 1);
                  pivotPoint = new PivotPoint();
                  pivotPoint.Overlay = true;
                  Add(pivotPoint);
                  volatility = SmoothMA(Day2Day(), maLength);
                  volatility.Plots[0].Pen.Color = Color.Green;
                  volatility.Panel = 1;
                  volatility.Overlay = true;
                  Add(volatility);
              }[/FONT]

      Comment


        #4
        Hi adamus,

        Adding the indicators in this way is unfortunately beyond the scope of support we can offer. The supported method of doing this can be seen in this sample:
        When running a strategy on a chart you may find the need to plot values onto a chart. If these values are internal strategy calculations that are difficult to migrate to an indicator, you can use the following technique to achieve a plot. NinjaTrader 8 With NinjaTrader 8 we introduced strategy plots which provide the ability
        TimNinjaTrader Customer Service

        Comment


          #5
          Tim,

          that sample says explicitly that it's not for backtesting. Are you sure it's the one you had in mind?

          Comment


            #6
            adamus,

            The purpose of that link was not for backtesting or using the concepts in the sample, but more to show you how the indicator is added. There is no indicator variable created. Just add the indicator you want directly and set the properties you want accordingly directly. This would be more appropriate: http://www.ninjatrader.com/support/f...ead.php?t=3228
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              OK, thanks but when I tried coding

              Code:
              Add(PivotPoint());
              NT wouldn't compile but gave the error:"NinjaTrader.Indicator.PivotPoint is a 'type' but is used as a variable."

              I looked at VOL() which works this way, but I couldn't see any difference in my script that would make it different.

              Comment


                #8
                OK I forgot I added some parameters that have to go in the constructor. Strange that the compilation error doesn't talk about constructors though.

                And now it doesn't throw the error.

                Thanks for the help.

                Comment


                  #9
                  When I try to add an indicator to an strategy (by clicking on the "Indicators" button in the GUI), I get an somewhat strange error stating:
                  You cannot add/change/remove an indicator until your prior request has completed loading historical data.
                  What does this error message mean? I'm not connected to an data provider (so the historical data is already downloaded), and the NinjaTrader Control Center doesn't shows an loading bar, or an error in the log.

                  Any thoughts about this would be very welcome,


                  EDIT: I've just been able to replicate this error:
                  (Not sure if this is also a step:
                  0. Open a new strategy analyzer window,)
                  1. Create a new strategy,
                  2. Run a backtest with this strategy on any instrument and any time frame.
                  3. Go to the "Chart"-tab and click on the "Indicators" button. In my case, this still works at this stage.
                  5. Click again on "Run Backtest" with the same settings/parameters.
                  6. Navigate back to the "Chart" tab, and click on "Indicators". In my case, this results in the above mentioned error message.

                  Does anyone know of a workaround for this, because it's quite convenient to set Default values.

                  Regards,
                  Attached Files
                  Last edited by J_o_s; 09-16-2010, 06:35 AM. Reason: Added steps how to replicate this error

                  Comment


                    #10
                    Hi J_o_s,

                    Try briefly selecting another instrument between your steps #5 and #6, from the left side list. Then switch back and try to add an indicator.
                    TimNinjaTrader Customer Service

                    Comment


                      #11
                      i am adding an indicator to a strategy ... same as the original issue for this thread ... best i can tell:

                      1) when i instantiate an object [eg. myIndy = new MyIndy(_myVar1, _myVar2); ], it compiles, but then produces the "IndicatorBase.InputInitialize" and "barsArray[0] == null" errors;

                      2) when i remove the "new", i am unable to compile as i get the "is a 'type' but is used like a 'variable'" error.

                      any insights? it would be great to know why we shouldn't instantiate an object. i thought that was the standard/preferred way of doing things. /scratches_head

                      cheers,
                      -e

                      Comment


                        #12
                        e-man, as Tim already mentioned this way of adding is not supported officially - the recommended way is layed out here - http://www.ninjatrader.com/support/f...ead.php?t=3228

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        591 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        343 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        103 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        556 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        553 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X