Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 jaybedreamin, Today, 05:56 PM
        0 responses
        3 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        18 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        1 view
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        9 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Working...
        X