Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnEachTick

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

    OnEachTick

    Hello,
    I am just wondering if there is something wrong here.

    I have an indicator on and it has been set to update on Each Tick.
    Now I have put a print statement when BarsInprogress == 0.
    I have a 30 minute chart on.

    Now I should see the result of my print statement on each tick right ?

    I see the print statement result only on the first tick of a new bar !

    Is there something I am missing here ?

    Thanks for your help.

    #2
    Hello blar58,

    Thank you for writing in.

    It would be expected for the print to output on each tick that comes in.

    Do you have a IsFirstTickOfBar check before your print evaluates? https://ninjatrader.com/support/help...ttickofbar.htm

    I have provided a sample indicator script demonstrating a print that occurs on each new tick that comes in.
    Attached Files
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Code:
      protected override void OnStateChange()
       {
      			 
           if (State == State.SetDefaults)
           {		
      	Calculate	          =Calculate.OnEachTick;
           }
           else if (State == State.Configure)
           {			
                // Bars In Progress 1
                AddDataSeries(BarsPeriodType.Tick, 1);					
           }
      }
      
      protected override void OnBarUpdate()
      {
      
          if( BarsInProgress == 0 )
      {
      				
          Print(Time[0]+" BEFORE Setting Variables");. 
          SettingVariablesTimerAndAlerts();
          Print(Time[0]+"AFTER Variables");	
          CompositeManager();
           Print(Time[0]+" Composite Manager done with great success !");
      }
      else
      if( BarsInProgress == 1 )
      {
            DataLoader();
      }
      Here is the code. Pretty simple but no print and no error message from the log or output window !

      It is not even updating on the first bar. Not updating on real time tick...
      Last edited by blar58; 04-08-2016, 01:12 PM.

      Comment


        #4
        Hello blar58,

        Please temporarily remove the calls to the custom methods and test once more.

        Does the behavior still persist?

        If the behavior still persists, can you please provide the script so I may test on my end?

        Additionally, can you verify if the sample script I have provided prints on every tick on your end?
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Hello ZacharyG

          Thanks for your response.

          I have tested your indicator on my PC it works fine.
          It would be difficult to send the indicator to you because it has more than 30000 lines of code but I have a question.

          I am also using OnMarketData method in the code. Simple question does OnMarketData come in conflict with OnBarUpdate for real time data process ?

          I am really confused about this

          Comment


            #6
            Originally posted by blar58 View Post
            Hello ZacharyG

            Thanks for your response.

            I have tested your indicator on my PC it works fine.
            It would be difficult to send the indicator to you because it has more than 30000 lines of code but I have a question.

            I am also using OnMarketData method in the code. Simple question does OnMarketData come in conflict with OnBarUpdate for real time data process ?

            I am really confused about this
            You have 30k lines of code and are confused about OnMarketData?!!!

            Are you saying there is a bug in NT8 vs NT7? I assume you've converted your code from NT7 ? Or is this a NT8 first with 30k lines?

            Comment


              #7
              Hello Sledge,

              That is a NinjaTrader 7 indicator that I coded myself and trying to convert.
              You are right I should not be confused about OnMarketData but this is something that makes me crazy. The code is the same but I get stuck at this problem.

              I have found something interesting but need to look deeper into this. I have added something new a third dateseries AddDataSeries("ES 06-16", new BarsPeriod(){BarsPeriodType.Minute, Value = 1 }, 930, " MyCustomOvernightSessionTamplate", false); and that seems to be the problem. I don't know why though !

              If I remove this it updates on each tick now from OnBarUpdate as it should ...
              Last edited by blar58; 04-08-2016, 10:28 PM.

              Comment


                #8
                Originally posted by blar58 View Post
                Hello Sledge,

                That is a NinjaTrader 7 indicator that I coded myself and trying to convert.
                You are right I should not be confused about OnMarketData but this is something that makes me crazy. The code is the same but I get stuck at this problem.

                I have found something interesting but need to look deeper into this. I have added something new a third dateseries AddDataSeries("ES 06-16", new BarsPeriod(){BarsPeriodType.Minute, Value = 1 }, 930, " MyCustomOvernightSessionTamplate", false); and that seems to be the problem. I don't know why though !

                If I remove this it updates on each tick now from OnBarUpdate as it should ...
                That just might be the issue.


                Can you produce a simplified test case that doesn't expose your 30k lines of proprietary code?

                My weekend looks rather null and void other than trying to find a cause to my main remaining issue:



                I might try to slap such a statement in and see what happens.

                Comment


                  #9
                  I will !

                  Thank you sledge !

                  Comment


                    #10
                    Here it is sledge.

                    It is obviously the problem
                    I think that I cannot mix different session templates which are not synchonize together.
                    Need some guidance about this.
                    Attached Files
                    Last edited by blar58; 04-09-2016, 07:13 AM.

                    Comment


                      #11
                      Originally posted by blar58 View Post
                      Here it is sledge.

                      It is obviously the problem
                      I think that I cannot mix different session templates which are not synchonize together.
                      Need some guidance about this.
                      I found this post. It appears highly NOT RECOMMENDED to call BarsPeriod inside of AddDataSeries!

                      Link here:

                      Comment


                        #12
                        Thanks sledge


                        I have resolved my problem using BarRequest to get data for my third DataSeries

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by aa731, Today, 02:54 AM
                        1 response
                        7 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Started by BarzTrading, Today, 07:25 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post BarzTrading  
                        Started by i019945nj, 12-14-2023, 06:41 AM
                        5 responses
                        65 views
                        0 likes
                        Last Post i019945nj  
                        Started by ruudawakening, Today, 12:58 AM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by thread, Yesterday, 11:58 PM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Working...
                        X