Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting just 24 hours Forex trades

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

    Getting just 24 hours Forex trades

    Hi Ninjas,

    I´m trying to fix an issue in the Strategy Analizer, cause when an optimization for a normal 24 hours Forex session is required ( For intraday purpose ) you'll get results that include trades out of that daily range. So, since I´m not a programmer, I was reading and I found something helpful, the "Bars.Session.GetNextBeginEnd". I discovered that I can know in that datetime format, which are my sessionBegin and my sessionEnd, but now I want to know:

    How can I call the Datetime of the current Bar (in the same format used for sessionEnd ) in order to compare if it continues to be within the same range?

    I was playing with Bars.GetDayBar(0).Time but it doesn't work

    Thanks

    #2
    Hello pstrusi,
    To get the time of the current bar simply use Time[0]. Please refer to our help guide to know more about it.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks Joydeep.

      As always, every time I solve some issue with your help, I post here how I did it.

      In this case, to obtain just the 24 hours trades in forex session, I added this at first to the code:

      if (Bars.FirstBarOfSession)
      Bars.Session.GetNextBeginEnd(BarsArray[0], 0, out sessionBegin, out sessionEnd);
      if (Time[0] < sessionEnd)
      {
      the code
      }

      Comment


        #4
        Hello pstrusi,
        Glad you could work it out.

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Please Joydeep, transmit this issue solved to Bertrand, cause it was thought to be included in the next major NT upgrade, and maybe there´s even an easier way to solve it, since I´m not a programmer, but at least I solved :-)

          Comment


            #6
            Hello pstrusi,
            Thanks for letting me know. I will inform Bertrand regarding it.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            68 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            38 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            63 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            62 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            53 views
            0 likes
            Last Post CarlTrading  
            Working...
            X