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 JonesJoker, 04-22-2024, 12:23 PM
            8 responses
            41 views
            0 likes
            Last Post JonesJoker  
            Started by timko, Today, 06:45 AM
            0 responses
            3 views
            0 likes
            Last Post timko
            by timko
             
            Started by Waxavi, 04-19-2024, 02:10 AM
            2 responses
            37 views
            0 likes
            Last Post poeds
            by poeds
             
            Started by chbruno, Yesterday, 04:10 PM
            1 response
            44 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by Max238, Today, 01:28 AM
            1 response
            25 views
            0 likes
            Last Post CactusMan  
            Working...
            X