Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How work with new tick

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

    How work with new tick

    Hello,
    I start strategy (settings on pictere)

    In code i write string word to file
    string str= System.Convert.ToString(GetCurrentAsk())+System.Co nvert.ToString(GetCurrentBid())+"i"+CurrentBar;
    But tick start from 20th bar and go up. how can i see last tick in 0 bar?
    Attached Files

    #2
    Welcome to our forums, please set the min bars required to 0 and then reload the strategy on your chart.

    Thanks,

    Comment


      #3
      Thank you for answer.
      Now strategy start from 0 bar, and go back -2 3 4 5 6 but I want that my robot count only new tick in real time.
      How can I do this?

      Comment


        #4
        If you want your strategy to work in realtime ony, try returning out of the OnBarUpdate() if it's called for historical data - http://www.ninjatrader.com/support/h...historical.htm

        Comment


          #5
          I add this code, but then I have not evens.
          And I don't saw new ticks on my chart, it is ok?

          Comment


            #6
            Walter, you would get no events then on historical data, the strategy would start working then on the first realtime bar (CalculateOnBarClose = true).

            Comment


              #7
              It is work.
              Thank you very much.
              But I see more ticks on chart, than events in strategy, why?

              Comment


                #8
                You're welcome, I'm not sure what exactly you're comparing to eachother to determine the events you see, could you please explain?

                Comment


                  #9
                  I thought that 1tick=1 event - OnBarUpdate
                  But really I see in file 2-3 ticks per minute, not more


                  protected override void OnBarUpdate()
                  {
                  if (Historical) return;
                  string str= System.Convert.ToString(GetCurrentAsk())+System.Co nvert.ToString(GetCurrentBid());
                  ...//write str to file
                  }

                  Comment


                    #10
                    Are you sure the strategy runs with CalculateOnBarClose = false in realtime? This would give you an OnBarUpdate() call on each tick / trade.

                    Comment


                      #11
                      I have got confused =(
                      I make CalculateOnBarClose = false.
                      Magic, chart draw all bars in real time and I have all tick in my strategy, but tonight it was stop and I can't switch on it again.

                      Comment


                        #12
                        Walter, sorry I'm not sure I follow you - what errors are you getting when you restart the strategy?

                        For historical data CalculateOnBarClose = false has no effect, it would always be true since the intrabar formation is not known, only the OHLCV of the underlying series.

                        Comment


                          #13
                          I don't understand, how open chart, which will draw bars in real-time. I do this once tomorow, but do not know how.

                          Comment


                            #14
                            Walter, it will depend on your session template in NT7 - per default NinjaTrader uses the cash hours of the instruments, for continuous 24 hrs data display (all available data) please try selecting the Default 24/7 session template on your charts, then apply the strategy with CalculateOnBarClose set to false.

                            Comment


                              #15
                              My template is Default 24/7.
                              My instrument 6E.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              116 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              61 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              40 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              43 views
                              0 likes
                              Last Post TheRealMorford  
                              Started by Mindset, 02-28-2026, 06:16 AM
                              0 responses
                              82 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Working...
                              X