Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

code to detect first day of history of chart

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

    code to detect first day of history of chart

    Hello,

    Could you tell me how I write the following :

    if (first day of history loaded)








    Thank you
    Last edited by SARdynamite; 07-08-2010, 11:40 PM.

    #2
    SARdynamite, there's no real method for this task so here's an idea : with CurrentBar you have access to the bar index, save the date to a variable on the first chart bar (CurrentBar == 0) and then start your conditions if your current chart date is greater than this (first new day since start of the chart).

    Comment


      #3
      Great. Thank you

      Comment


        #4
        Excuse me but how do you get the date of the day of the bar. Can't find it. Thanks

        Comment


          #5
          You can use ToDay() for this task - http://www.ninjatrader-support.com/H...eV6/ToDay.html

          Comment


            #6
            if (CurrentBar==0) d1=ToDay(Time[0]);

            gets me d1=0

            I'm on Range bars. Is that right ?

            Comment


              #7
              Works for me here, how did you define your d1 varilable? An int?

              Comment


                #8
                sorry, I was using if (CurrentBar<1) return; before

                works just fine

                Comment


                  #9
                  Great, should've asked about it firstplace...

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by sjsj2732, 03-23-2026, 04:31 AM
                  0 responses
                  42 views
                  0 likes
                  Last Post sjsj2732  
                  Started by NullPointStrategies, 03-13-2026, 05:17 AM
                  0 responses
                  294 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  290 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  135 views
                  1 like
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  98 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Working...
                  X