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 cmtjoancolmenero, Yesterday, 03:58 PM
        8 responses
        31 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by helpwanted, Today, 03:06 AM
        2 responses
        21 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by DayTradingDEMON, Today, 09:28 AM
        0 responses
        8 views
        0 likes
        Last Post DayTradingDEMON  
        Started by navyguy06, Today, 09:28 AM
        0 responses
        2 views
        0 likes
        Last Post navyguy06  
        Started by rjbtrade1, 11-30-2023, 04:38 PM
        2 responses
        77 views
        0 likes
        Last Post DavidHP
        by DavidHP
         
        Working...
        X