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 Aviram Y, Today, 05:29 AM
        0 responses
        2 views
        0 likes
        Last Post Aviram Y  
        Started by quantismo, 04-17-2024, 05:13 PM
        3 responses
        25 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by ScottWalsh, 04-16-2024, 04:29 PM
        7 responses
        34 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by cls71, Today, 04:45 AM
        0 responses
        6 views
        0 likes
        Last Post cls71
        by cls71
         
        Started by mjairg, 07-20-2023, 11:57 PM
        3 responses
        217 views
        1 like
        Last Post PaulMohn  
        Working...
        X