Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add instrument to chart in STRATEGY Analyzer

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

    #61
    I think this because I set Time Frame for backtesting that is wider than index value has. So, how t avoid this?

    Comment


      #62
      You should be able to use .Count - 1 and test that against your value you are wanting to use.
      Such like the this -
      Code:
      if( myTestValue < SMA(14).Count - 1)
      {
           //do something here
      }
      Cal H.NinjaTrader Customer Service

      Comment


        #63
        I have read about "Count" in Help. Please explaine in your words. Is it just additional tool as CurrentBar?

        Comment


          #64
          Yes, in way. This is a count of the object that you are attaching it to.

          The difference is Count starts at 1 while CurrentBar starts at 0
          Cal H.NinjaTrader Customer Service

          Comment


            #65
            So, in my case after CurrentBars[0]<=BarsRequired the solution for indicator value will be
            if(MyIndex().Count-1==0) return

            Comment


              #66
              Have you tested this out?
              Cal H.NinjaTrader Customer Service

              Comment


                #67
                Originally posted by NinjaTrader_Cal View Post
                Have you tested this out?
                No =) I just want to clarify =)

                Comment


                  #68
                  Well. I tried my expression in strategy. Still this error.
                  I sighted that it occurs on bar next to what I set in Backtest as Min Bars required=20. Erroe occurs on 21 bar. And in indicator script I set other value=400.
                  But I think it's not important what value is there. More important to set condition when indicator will check if it has some value.

                  Comment


                    #69
                    Alexstox,

                    can you please attach your strategy so that I may test this out on my end?

                    What instrument are you testing? What time frame? What chart interval are you using?
                    Cal H.NinjaTrader Customer Service

                    Comment


                      #70
                      There is bars object in strategy script, for which I write
                      if (CurrentBars[0] <= BarsRequired) return;
                      There is indicator object in strategy script, for which I can't use "CurrentBars[0] <= BarsRequired"
                      What can I write for indicator in strategy to check is it have some value or not?!?!?
                      Because MyIndex() starts to have some value from 1993 year, and bars object starts from 1990. That's why when everything is OK with bars object, MyIndex() still doesn't have any value.

                      Comment


                        #71
                        Alexstox,

                        I believe this example is what you are looking for -
                        http://www.ninjatrader.com/support/f...ad.php?t=33061

                        This is a way to check if your indicator's plots are valid before accessing them.
                        Cal H.NinjaTrader Customer Service

                        Comment


                          #72
                          Originally posted by NinjaTrader_Cal View Post
                          Alexstox,

                          I believe this example is what you are looking for -
                          http://www.ninjatrader.com/support/f...ad.php?t=33061

                          This is a way to check if your indicator's plots are valid before accessing them.
                          Where to read more about ContainsValue() and "%" (if(CurrentBar % N == 0)

                          Comment


                            #73
                            First is from dotnetperls which is a good resource -
                            http://www.dotnetperls.com/containsvalue

                            the second is from the MSDN site for all .NET and C# related items -
                            http://msdn.microsoft.com/en-us/library/0w4e0fzs.aspx
                            Cal H.NinjaTrader Customer Service

                            Comment


                              #74
                              Well. I set in strategy script
                              if(!MyIndex(MyIndex1).Values[0].ContainsValue(0)) return;
                              But this still caused error. Maybe because there are no "0" value? How to set "nothing" or "no data" instead of "0".

                              In indicator I don't know what to set, because I use every bar there and this can't help me
                              if(CurrentBar % N == 0) EveryNPlot.Set(Median[0]);

                              Comment


                                #75
                                This checks if you have NOT called a "Set" method on the DataSeries for the current bar your processing. Internally a dummy value does exist and this is what this checks for in the ContainsValue() check. This is coming back true then indicating that something has been set.

                                We needed to investigate further on the dataSeries "Set" side to see why a value is being set for the current bar.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Jonafare, 12-06-2012, 03:48 PM
                                5 responses
                                3,985 views
                                0 likes
                                Last Post rene69851  
                                Started by Fitspressorest, Today, 01:38 PM
                                0 responses
                                2 views
                                0 likes
                                Last Post Fitspressorest  
                                Started by Jonker, Today, 01:19 PM
                                0 responses
                                2 views
                                0 likes
                                Last Post Jonker
                                by Jonker
                                 
                                Started by futtrader, Today, 01:16 PM
                                0 responses
                                7 views
                                0 likes
                                Last Post futtrader  
                                Started by Segwin, 05-07-2018, 02:15 PM
                                14 responses
                                1,792 views
                                0 likes
                                Last Post aligator  
                                Working...
                                X