Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

most recent cross and count

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

    #16
    Adam/Ryan,

    need to know two things:
    1. As I explained above about my MA/indicator , If I've 10 stocks (rows) and 5 columns (5m/15m...)
    how many instances of my indicator will be runing ?.
    2. I need to run the pivot check to do a calculation but only once I need to do this, how do I control this in onBarUpdate() only once per session, if possible.
    here is the code I'm using as a call in the onBarUpdate()

    private void getPivotValue(){

    if (Pivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20).PP.ContainsValue(0))
    {
    // Prints the current pivot point value
    pivotPP = Pivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20).PP[0];
    Print(Instrument.MasterInstrument.Name+"pivot is " + pivotPP.ToString());

    }
    }// end

    Comment


      #17
      1) A separate instance will be created for each instrument and interval. Looks like 50 in your case.

      2) Any calculations that you need done only once per session could be done during Bars.FirstBarOfSession
      Last edited by NinjaTrader_RyanM1; 06-13-2012, 12:31 PM.
      Ryan M.NinjaTrader Customer Service

      Comment


        #18
        need a little help with the multi-time coding:
        instead of accessing/checking with BarsInProgress flag can I use BarsPeriod.Value flag to check and
        process ?.

        Comment


          #19
          Unfortunately BarsInProgress can't be substituted by checks to the BarsPeriod - you would need to know which series triggered the OnBarUpdate() call and this feedback is received with BarsInProgress.

          Comment


            #20
            all i have in my strategy to draw an arrow if it is an end of session bar. but it is only drawing for last 30 days where i have 44 days loaded in my chart.I set the lookback period to infinite, must be missing a simple thing. help

            Comment


              #21
              kinshin9 - Sorry not sure. Please feel free to post a screenshot of your chart and a simple code snippet showing what you're trying to do.
              Ryan M.NinjaTrader Customer Service

              Comment


                #22
                Ryan,

                here is the simple code and attached is the image, drawing Magenta down arrow at every end of the session bar starting from 7/8 until 6/21 and ignoring the earlier days. I even made look back to infinite
                in my strategy.
                here is the code:
                if(Bars.LastBarOfSession)
                DrawArrowDown("dwnarrow"+ CurrentBar , false, 0, High[0]+0.3, Color.Magenta);
                Attached Files

                Comment


                  #23
                  Hello kinshin9,
                  Please change the BarsRequired property to say 0 (zero) from the default 20 and see if you are still getting the same result or not.

                  Please refer to our help guide to know more about it.
                  JoydeepNinjaTrader Customer Service

                  Comment


                    #24
                    thought missing something simple. thanks, it worked.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    579 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    334 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    101 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    554 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    551 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X