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 JesseOffshore, Today, 09:40 PM
            0 responses
            1 view
            0 likes
            Last Post JesseOffshore  
            Started by WHICKED, 04-26-2024, 12:56 PM
            4 responses
            139 views
            0 likes
            Last Post WHICKED
            by WHICKED
             
            Started by ezrollin, 02-26-2022, 11:14 PM
            7 responses
            207 views
            0 likes
            Last Post kenz987
            by kenz987
             
            Started by rocketman7, Today, 08:34 PM
            0 responses
            5 views
            0 likes
            Last Post rocketman7  
            Started by rt61968, 02-17-2018, 05:24 PM
            3 responses
            2,736 views
            0 likes
            Last Post MasterEtrad3  
            Working...
            X