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,
    BertrandNinjaTrader Customer Service

    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
        BertrandNinjaTrader Customer Service

        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).
            BertrandNinjaTrader Customer Service

            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?
                BertrandNinjaTrader Customer Service

                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.
                    BertrandNinjaTrader Customer Service

                    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.
                        BertrandNinjaTrader Customer Service

                        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.
                            BertrandNinjaTrader Customer Service

                            Comment


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

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by md4866, 05-01-2024, 08:15 PM
                              2 responses
                              18 views
                              0 likes
                              Last Post md4866
                              by md4866
                               
                              Started by samish18, Today, 12:20 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post samish18  
                              Started by thread, 04-15-2024, 11:58 PM
                              3 responses
                              48 views
                              0 likes
                              Last Post Georg1o
                              by Georg1o
                               
                              Started by leojimenezp, 04-20-2024, 05:49 PM
                              4 responses
                              49 views
                              0 likes
                              Last Post leojimenezp  
                              Started by nicthe, Today, 09:24 AM
                              1 response
                              7 views
                              0 likes
                              Last Post nicthe
                              by nicthe
                               
                              Working...
                              X