• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

first tick of bar

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

    first tick of bar

    I am having an issue with first tick of bar. I am not sure if I am doing it correctly.

    protected override void Initialize()
    {
    Overlay = true;
    CalculateOnBarClose = false ;

    }


    /// </summary>
    protected override void OnBarUpdate()
    {

    if (CurrentBar == Bars.Count - 2)
    {
    int nCount = this.list.Count;
    bool bPriceFound = false;

    if (FirstTickOfBar == true)
    {
    // print my information
    }
    else
    {
    // collect information
    }


    the issue is it is always printing and never collecting information. It never goes to the the else statement

    }

    #2
    Hello ballboy11,

    Thank you for your note.

    When a bar is first created the open of that bar is the first tick of that bar, so every bar should meet your condition.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      I understand but on a minute chart or a 5 minute etc it is still going through the firsttickof bar everytick

      if (FirstTickOfBar == true)
      {


      Print("in first tick of bar " + Time[0]);
      }


      look at the picture below on the output this is on a 1 minute chart
      Attached Files

      Comment


        #4
        Hello ballboy11,

        May I confirm that the output window you've shared a picture of is a minute chart rather than a tick chart? I am unable to replicate with a minute chart but when I use a tick chart my results match what you've posted.

        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Arkadiy_B, Today, 06:43 AM
        0 responses
        2 views
        0 likes
        Last Post Arkadiy_B  
        Started by leontancfa, Today, 06:09 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by soulfx, 12-01-2017, 08:44 AM
        3 responses
        1,019 views
        0 likes
        Last Post NinjaTrader_EricB  
        Started by Parmenides48, 04-09-2019, 03:32 AM
        10 responses
        49 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by NinjaCustomer, Today, 01:48 AM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_EricB  
        Working...
        X