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

Bars.FirstBarOfSession

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

    Bars.FirstBarOfSession

    I am using Bars.FirstBarOfSession to do a logic check when the market opens but it is returning false on the first bar. I am using it with FESX 0615 1min bars and CalculateOnBarClose is set to true. Could this be because it will only be true when the bar closes?

    #2
    Hello,

    Thank you for the question.

    Yes this would apply to the CalculateOnBarClose or the Close of the bar as well. If you are running COBC true, it would be the close of the bar otherwise with COBC false it would be the first tick of the bar that the session has started on.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse

      OK I thought that was the case so I added tick bars to process Bars.FirstBarsOfSession on the first tick that comes in. This didnt work either and after going through the program flow with MS Visual Studio there is data coming in after 8.00 am CET which not from the current session. When I try and use Bars.BarsSinceSession for my logic it doesnt work either of course as it is considered bars from the last session and the int getting returned is in the order of 850.

      All of this means I have no way of processing logic when the market opens. I am running the strategy on FESX 09-15 on 6th July 2015.


      I looked at the data coming in again and because I have COBC = true when the market opens at 8 am it processes the close of the bar from the day before. So my logic then works off that close which is much higher then the opening tick of the current session. This is causing the problem. Is the only way around this to include a time condition?


      I solved the problem with :-

      Code:
      if(ToTime(Time[0])> 215900)
      	return;
      Last edited by GKonheiser; 09-24-2015, 04:34 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by andrewtrades, Today, 04:57 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      3 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      436 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      7 views
      0 likes
      Last Post FAQtrader  
      Started by rocketman7, Today, 09:41 AM
      5 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X